Shortcuts

备注

您正在阅读 MMClassification 0.x 版本的文档。MMClassification 0.x 会在 2022 年末被切换为次要分支。建议您升级到 MMClassification 1.0 版本,体验更多新特性和新功能。请查阅 MMClassification 1.0 的安装教程迁移教程以及更新日志

mmcls.core.support

mmcls.core.support(pred, target, average_mode='macro')[源代码]

Calculate the total number of occurrences of each label according to the prediction and target.

参数
  • pred (torch.Tensor | np.array) – The model prediction with shape (N, C).

  • target (torch.Tensor | np.array) – The target of each prediction with shape (N, 1) or (N,).

  • average_mode (str) – The type of averaging performed on the result. Options are ‘macro’ and ‘none’. If ‘none’, the scores for each class are returned. If ‘macro’, calculate metrics for each class, and find their unweighted sum. Defaults to ‘macro’.

返回

Support.

  • If the average_mode is set to macro, the function returns a single float.

  • If the average_mode is set to none, the function returns a np.array with shape C.

返回类型

float | np.array

Read the Docs v: latest
Versions
master
latest
1.x
dev-1.x
Downloads
pdf
html
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.