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

Function keypoint_auc

tools/preprocess/pose2d_utils.py:527–556  ·  view source on GitHub ↗

Calculate the pose accuracy of PCK for each individual keypoint and the averaged accuracy across all keypoints for coordinates. Note: - batch_size: N - num_keypoints: K Args: pred (np.ndarray[N, K, 2]): Predicted keypoint location. gt (np.ndarray[N, K, 2

(pred, gt, mask, normalize, num_step=20)

Source from the content-addressed store, hash-verified

525
526
527def keypoint_auc(pred, gt, mask, normalize, num_step=20):
528 """Calculate the pose accuracy of PCK for each individual keypoint and the
529 averaged accuracy across all keypoints for coordinates.
530
531 Note:
532 - batch_size: N
533 - num_keypoints: K
534
535 Args:
536 pred (np.ndarray[N, K, 2]): Predicted keypoint location.
537 gt (np.ndarray[N, K, 2]): Groundtruth keypoint location.
538 mask (np.ndarray[N, K]): Visibility of the target. False for invisible
539 joints, and True for visible. Invisible joints will be ignored for
540 accuracy calculation.
541 normalize (float): Normalization factor.
542
543 Returns:
544 float: Area under curve.
545 """
546 nor = np.tile(np.array([[normalize, normalize]]), (pred.shape[0], 1))
547 x = [1.0 * i / num_step for i in range(num_step)]
548 y = []
549 for thr in x:
550 _, avg_acc, _ = keypoint_pck_accuracy(pred, gt, mask, thr, nor)
551 y.append(avg_acc)
552
553 auc = 0
554 for i in range(num_step):
555 auc += 1.0 / num_step * y[i]
556 return auc
557
558
559def keypoint_nme(pred, gt, mask, normalize_factor):

Callers

nothing calls this directly

Calls 2

keypoint_pck_accuracyFunction · 0.85
appendMethod · 0.80

Tested by

no test coverage detected