Shortcuts

MultiLabelLinearClsHead

class mmpretrain.models.heads.MultiLabelLinearClsHead(num_classes, in_channels, loss={'type': 'CrossEntropyLoss', 'use_sigmoid': True}, thr=None, topk=None, init_cfg={'layer': 'Linear', 'std': 0.01, 'type': 'Normal'})[源代码]

Linear classification head for multilabel task.

参数:
  • loss (dict) – Config of classification loss. Defaults to dict(type=’CrossEntropyLoss’, use_sigmoid=True).

  • thr (float, optional) – Predictions with scores under the thresholds are considered as negative. Defaults to None.

  • topk (int, optional) – Predictions with the k-th highest scores are considered as positive. Defaults to None.

  • init_cfg (dict, optional) – The extra init config of layers. Defaults to use dict(type=’Normal’, layer=’Linear’, std=0.01).

备注

If both thr and topk are set, use thr` to determine positive predictions. If neither is set, use ``thr=0.5 as default.

forward(feats)[源代码]

The forward process.

pre_logits(feats)[源代码]

The process before the final classification head.

The input feats is a tuple of tensor, and each tensor is the feature of a backbone stage. In MultiLabelLinearClsHead, we just obtain the feature of the last stage.

Read the Docs v: latest
Versions
latest
stable
mmcls-1.x
mmcls-0.x
dev
Downloads
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.