Return the percentage below the distance threshold, while ignoring distances values with -1. Note: batch_size: N Args: distances (np.ndarray[N, ]): The normalized distances. thr (float): Threshold of the distances. Returns: float: Percentage of dista
(distances, thr=0.5)
| 383 | |
| 384 | |
| 385 | def _distance_acc(distances, thr=0.5): |
| 386 | """Return the percentage below the distance threshold, while ignoring |
| 387 | distances values with -1. |
| 388 | |
| 389 | Note: |
| 390 | batch_size: N |
| 391 | Args: |
| 392 | distances (np.ndarray[N, ]): The normalized distances. |
| 393 | thr (float): Threshold of the distances. |
| 394 | |
| 395 | Returns: |
| 396 | float: Percentage of distances below the threshold. |
| 397 | If all target keypoints are missing, return -1. |
| 398 | """ |
| 399 | distance_valid = distances != -1 |
| 400 | num_distance_valid = distance_valid.sum() |
| 401 | if num_distance_valid > 0: |
| 402 | return (distances[distance_valid] < thr).sum() / num_distance_valid |
| 403 | return -1 |
| 404 | |
| 405 | |
| 406 | def _get_max_preds(heatmaps): |
no outgoing calls
no test coverage detected