mmcls.core.average_performance¶
- mmcls.core.average_performance(pred, target, thr=None, k=None)[source]¶
Calculate CP, CR, CF1, OP, OR, OF1, where C stands for per-class average, O stands for overall average, P stands for precision, R stands for recall and F1 stands for F1-score.
- Parameters
pred (torch.Tensor | np.ndarray) – The model prediction with shape (N, C), where C is the number of classes.
target (torch.Tensor | np.ndarray) – The target of each prediction with shape (N, C), where C is the number of classes. 1 stands for positive examples, 0 stands for negative examples and -1 stands for difficult examples.
thr (float) – The confidence threshold. Defaults to None.
k (int) – Top-k performance. Note that if thr and k are both given, k will be ignored. Defaults to None.
- Returns
(CP, CR, CF1, OP, OR, OF1)
- Return type