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)
| 557 | |
| 558 | |
| 559 | def 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 | |
| 582 | def keypoint_epe(pred, gt, mask): |
nothing calls this directly
no test coverage detected