MCPcopy Create free account
hub / github.com/OpenGVLab/HumanBench / _distance_acc

Function _distance_acc

PATH/core/data/transforms/post_transforms.py:385–403  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

383
384
385def _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
406def _get_max_preds(heatmaps):

Callers 1

keypoint_pck_accuracyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected