MCPcopy Create free account
hub / github.com/3DAnimals/3DAnimals / transfer_keypoints

Function transfer_keypoints

evaluation/evaluate.py:461–472  ·  view source on GitHub ↗
(source_verts, source_verts_visibility, target_verts, source_kp)

Source from the content-addressed store, hash-verified

459
460
461def transfer_keypoints(source_verts, source_verts_visibility, target_verts, source_kp):
462 # tranfer keypoints to target image
463 # for each keypoint in source frame, find the closest visible vertex
464 source_verts[source_verts_visibility == 0] = np.inf
465 dists = np.linalg.norm(source_verts[None, :, :] - source_kp[:, None, :], axis=2)
466 vert_idx = np.argmin(dists, axis=1)
467
468 # find these vertices in target frame and measrue the erorr between the target keypoint
469 target_kp_pred = target_verts[vert_idx]
470
471 aux = {"vert_idx": vert_idx}
472 return target_kp_pred, aux
473
474
475def main():

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected