JhmdbPCKAccuracy¶
- class mmeval.metrics.JhmdbPCKAccuracy(thr: float = 0.5, norm_item: Union[str, Sequence[str]] = 'bbox', **kwargs)[源代码]¶
PCK accuracy evaluation metric for Jhmdb 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
'bbox'
.**kwargs – Keyword parameters passed to
BaseMetric
.
实际案例
>>> from mmeval import JhmdbPCKAccuracy >>> import numpy as np >>> num_keypoints = 15 >>> keypoints = np.random.random((1, num_keypoints, 2)) * 10 >>> predictions = [{'coords': keypoints}] >>> keypoints_visible = np.ones((1, num_keypoints)).astype(bool) >>> torso_size = np.random.random((1, 2)) * 10 >>> groundtruths = [{ ... 'coords': keypoints, ... 'mask': keypoints_visible, ... 'torso_size': torso_size, ... }] >>> jhmdb_pckh_metric = JhmdbPCKAccuracy(thr=0.2, norm_item='torso') >>> jhmdb_pckh_metric(predictions, groundtruths) OrderedDict([('Head tPCK', 1.0), ('Sho tPCK', 1.0), ('Elb tPCK', 1.0), ('Wri tPCK', 1.0), ('Hip tPCK', 1.0), ('Knee tPCK', 1.0), ('Ank tPCK', 1.0), ('Mean tPCK', 1.0)])