MCPcopy
hub / github.com/NVlabs/imaginaire / get_mean_dists

Function get_mean_dists

imaginaire/model_utils/fs_vid2vid.py:599–608  ·  view source on GitHub ↗

r"""Get the mean xy distances of keypoints wrt face center.

(pts, face_cen)

Source from the content-addressed store, hash-verified

597 ref_face_cen = np.mean(ref_keypoints[central_keypoints, :], axis=0)
598
599 def get_mean_dists(pts, face_cen):
600 r"""Get the mean xy distances of keypoints wrt face center."""
601 mean_dists_x, mean_dists_y = [], []
602 pts_cen = np.mean(pts, axis=0)
603 for p, pt in enumerate(pts):
604 mean_dists_x.append(np.linalg.norm(pt - pts_cen))
605 mean_dists_y.append(np.linalg.norm(pts_cen - face_cen))
606 mean_dist_x = sum(mean_dists_x) / len(mean_dists_x) + 1e-3
607 mean_dist_y = sum(mean_dists_y) / len(mean_dists_y) + 1e-3
608 return mean_dist_x, mean_dist_y
609
610 if dist_scale_x is None:
611 dist_scale_x, dist_scale_y = [None] * len(part_list), \

Callers 1

normalize_facesFunction · 0.70

Calls 1

normMethod · 0.80

Tested by

no test coverage detected