KeypointAUC¶
- class mmeval.metrics.KeypointAUC(norm_factor: float = 30, num_thrs: int = 20, **kwargs)[源代码]¶
AUC evaluation metric.
Calculate the Area Under Curve (AUC) of keypoint PCK accuracy.
By altering the threshold percentage in the calculation of PCK accuracy, AUC can be generated to further evaluate the pose estimation algorithms.
注解
length of dataset: N
num_keypoints: K
number of keypoint dimensions: D (typically D = 2)
- 参数
norm_factor (float) – AUC normalization factor, Defaults to 30 (pixels).
num_thrs (int) – Number of thresholds to calculate AUC. Defaults to 20.
**kwargs – Keyword parameters passed to
mmeval.BaseMetric
. Must includedataset_meta
in order to compute the metric.
实际案例
>>> from mmeval import KeypointAUC >>> import numpy as np >>> auc_metric = KeypointAUC(norm_factor=20, num_thrs=4) >>> output = np.array([[[10., 4.], ... [10., 18.], ... [ 0., 0.], ... [40., 40.], ... [20., 10.]]]) >>> target = np.array([[[10., 0.], ... [10., 10.], ... [ 0., -1.], ... [30., 30.], ... [ 0., 10.]]]) >>> keypoints_visible = np.array([[True, True, False, True, True]]) >>> num_keypoints = 15 >>> prediction = {'coords': output} >>> groundtruth = {'coords': target, 'mask': keypoints_visible} >>> predictions = [prediction] >>> groundtruths = [groundtruth] >>> auc_metric(predictions, groundtruths) OrderedDict([('AUC@4', 0.375)])
- add(predictions: List[Dict], groundtruths: List[Dict]) → None[源代码]¶
Process one batch of predictions and groundtruths and add the intermediate results to self._results.
- 参数
predictions (Sequence[dict]) –
Predictions from the model. Each prediction dict has the following keys:
coords (np.ndarray, [1, K, D]): predicted keypoints coordinates
groundtruths (Sequence[dict]) –
The ground truth labels. Each groundtruth dict has the following keys:
coords (np.ndarray, [1, K, D]): ground truth keypoints coordinates
mask (np.ndarray, [1, K]): ground truth keypoints_visible