Shortcuts

ConformerHead

class mmpretrain.models.heads.ConformerHead(num_classes, in_channels, init_cfg={'layer': 'Linear', 'std': 0.02, 'type': 'TruncNormal'}, **kwargs)[source]

Linear classifier head.

Parameters:
  • num_classes (int) – Number of categories excluding the background category.

  • in_channels (Sequence[int]) – Number of channels in the input feature map.

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

forward(feats)[source]

The forward process.

pre_logits(feats)[source]

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 ConformerHead, we just obtain the feature of the last stage.

predict(feats, data_samples=None)[source]

Inference without augmentation.

Parameters:
  • 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[DataSample], optional) – The annotation data of every samples. If not None, set pred_label of the input data samples. Defaults to None.

Returns:

A list of data samples which contains the predicted results.

Return type:

List[DataSample]