src.evaluation_metric.pck¶
- src.evaluation_metric.pck(x: torch.Tensor, x_gt: torch.Tensor, perm_mat: torch.Tensor, dist_threshs: torch.Tensor, ns: torch.Tensor) torch.Tensor [source]¶
Percentage of Correct Keypoints (PCK) evaluation metric.
If the distance between predicted keypoint and the ground truth keypoint is smaller than a given threshold, than it is regraded as a correct matching.
This is the evaluation metric used by “Zanfir et al. Deep Learning of Graph Matching. CVPR 2018.”
- Parameters
x – \((b\times n \times 2)\) candidate coordinates. \(n\): number of nodes in input graph
x_gt – \((b\times n_{gt} \times 2)\) ground truth coordinates. \(n_{gt}\): number of nodes in ground truth graph
perm_mat – \((b\times n \times n_{gt})\) permutation matrix or doubly-stochastic matrix indicating node-to-node correspondence
dist_threshs – \((b\times m)\) a tensor contains thresholds in pixel. \(m\): number of thresholds for each batch
ns – \((b)\) number of exact pairs. We support batched instances with different number of nodes, and
ns
is required to specify the exact number of nodes of each instance in the batch.
- Returns
\((m)\) the PCK values of this batch
Note
An example of
dist_threshs
for 4 batches and 2 thresholds:[[10, 20], [10, 20], [10, 20], [10, 20]]