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)
| 580 | |
| 581 | |
| 582 | def 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 | |
| 605 | def _taylor(heatmap, coord): |
nothing calls this directly
no test coverage detected