KeypointEndPointError¶
- class mmeval.metrics.KeypointEndPointError(dataset_meta: Optional[Dict] = None, dist_collect_mode: str = 'unzip', dist_backend: Optional[str] = None, logger: Optional[logging.Logger] = None)[源代码]¶
EPE evaluation metric.
Calculate the end-point error (EPE) of keypoints.
注解
length of dataset: N
num_keypoints: K
number of keypoint dimensions: D (typically D = 2)
实际案例
>>> from mmeval.metrics import KeypointEndPointError >>> import numpy as np >>> 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]]) >>> predictions = [{'coords': output}] >>> groundtruths = [{'coords': target, 'mask': keypoints_visible}] >>> epe_metric = KeypointEndPointError() >>> epe_metric(predictions, groundtruths) {'EPE': 11.535533905029297}
- add(predictions: Sequence[Dict], groundtruths: Sequence[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