EfficientFormerClsHead¶
- class mmcls.models.heads.EfficientFormerClsHead(num_classes, in_channels, distillation=True, init_cfg={'layer': 'Linear', 'std': 0.01, 'type': 'Normal'}, *args, **kwargs)[源代码]¶
EfficientFormer classifier head.
- 参数
num_classes (int) – Number of categories excluding the background category.
in_channels (int) – Number of channels in the input feature map.
distillation (bool) – Whether use a additional distilled head. Defaults to True.
init_cfg (dict) – The extra initialization configs. Defaults to
dict(type='Normal', layer='Linear', std=0.01)
.
- loss(feats, data_samples, **kwargs)[源代码]¶
Calculate losses from the classification score.
- 参数
feats (tuple[Tensor]) – The features extracted from the backbone. Multiple stage inputs are acceptable but only the last stage will be used to classify. The shape of every item should be
(num_samples, num_classes)
.data_samples (List[ClsDataSample]) – The annotation data of every samples.
**kwargs – Other keyword arguments to forward the loss module.
- 返回
a dictionary of loss components
- 返回类型