MpiiPCKAccuracy¶
- class mmeval.metrics.MpiiPCKAccuracy(thr: float = 0.5, norm_item: Union[str, Sequence[str]] = 'head', **kwargs)[源代码]¶
PCKh accuracy evaluation metric for MPII dataset.
Calculate the pose accuracy of Percentage of Correct Keypoints (PCK) for each individual keypoint and the averaged accuracy across all keypoints. PCK metric measures accuracy of the localization of the body joints. The distances between predicted positions and the ground-truth ones are typically normalized by the person bounding box size. The threshold (thr) of the normalized distance is commonly set as 0.05, 0.1 or 0.2 etc.
注解
length of dataset: N
num_keypoints: K
number of keypoint dimensions: D (typically D = 2)
- 参数
thr (float) – Threshold of PCK calculation. Defaults to 0.5.
norm_item (str | Sequence[str]) – The item used for normalization. Valid items include ‘bbox’, ‘head’, ‘torso’, which correspond to ‘PCK’, ‘PCKh’ and ‘tPCK’ respectively. Defaults to
'head'
.**kwargs – Keyword parameters passed to
BaseMetric
.
实际案例
>>> from mmeval import MpiiPCKAccuracy >>> import numpy as np >>> num_keypoints = 16 >>> keypoints = np.random.random((1, num_keypoints, 2)) * 10 >>> predictions = [{'coords': keypoints}] >>> keypoints_visible = np.ones((1, num_keypoints)).astype(bool) >>> head_size = np.random.random((1, 2)) * 10 >>> groundtruths = [{ ... 'coords': keypoints + 1.0, ... 'mask': keypoints_visible, ... 'head_size': head_size, ... }] >>> mpii_pckh_metric = MpiiPCKAccuracy(thr=0.3, norm_item='head') >>> mpii_pckh_metric(predictions, groundtruths) OrderedDict([('Head', 100.0), ('Shoulder', 100.0), ('Elbow', 100.0), ('Wrist', 100.0), ('Hip', 100.0), ('Knee', 100.0), ('Ankle', 100.0), ('PCKh', 100.0), ('PCKh@0.1', 100.0)])