MCPcopy Create free account
hub / github.com/ModelTC/LightX2V / keypoint_epe

Function keypoint_epe

tools/preprocess/pose2d_utils.py:582–602  ·  view source on GitHub ↗

Calculate the end-point error. Note: - batch_size: N - num_keypoints: K Args: pred (np.ndarray[N, K, 2]): Predicted keypoint location. gt (np.ndarray[N, K, 2]): Groundtruth keypoint location. mask (np.ndarray[N, K]): Visibility of the target. False f

(pred, gt, mask)

Source from the content-addressed store, hash-verified

580
581
582def keypoint_epe(pred, gt, mask):
583 """Calculate the end-point error.
584
585 Note:
586 - batch_size: N
587 - num_keypoints: K
588
589 Args:
590 pred (np.ndarray[N, K, 2]): Predicted keypoint location.
591 gt (np.ndarray[N, K, 2]): Groundtruth keypoint location.
592 mask (np.ndarray[N, K]): Visibility of the target. False for invisible
593 joints, and True for visible. Invisible joints will be ignored for
594 accuracy calculation.
595
596 Returns:
597 float: Average end-point error.
598 """
599
600 distances = _calc_distances(pred, gt, mask, np.ones((pred.shape[0], pred.shape[2]), dtype=np.float32))
601 distance_valid = distances[distances != -1]
602 return distance_valid.sum() / max(1, len(distance_valid))
603
604
605def _taylor(heatmap, coord):

Callers

nothing calls this directly

Calls 1

_calc_distancesFunction · 0.85

Tested by

no test coverage detected