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

Function keypoint_nme

tools/preprocess/pose2d_utils.py:559–579  ·  view source on GitHub ↗

Calculate the normalized mean error (NME). 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 tar

(pred, gt, mask, normalize_factor)

Source from the content-addressed store, hash-verified

557
558
559def keypoint_nme(pred, gt, mask, normalize_factor):
560 """Calculate the normalized mean error (NME).
561
562 Note:
563 - batch_size: N
564 - num_keypoints: K
565
566 Args:
567 pred (np.ndarray[N, K, 2]): Predicted keypoint location.
568 gt (np.ndarray[N, K, 2]): Groundtruth keypoint location.
569 mask (np.ndarray[N, K]): Visibility of the target. False for invisible
570 joints, and True for visible. Invisible joints will be ignored for
571 accuracy calculation.
572 normalize_factor (np.ndarray[N, 2]): Normalization factor.
573
574 Returns:
575 float: normalized mean error
576 """
577 distances = _calc_distances(pred, gt, mask, normalize_factor)
578 distance_valid = distances[distances != -1]
579 return distance_valid.sum() / max(1, len(distance_valid))
580
581
582def keypoint_epe(pred, gt, mask):

Callers

nothing calls this directly

Calls 1

_calc_distancesFunction · 0.85

Tested by

no test coverage detected