Shortcuts

StackedLinearClsHead

class mmpretrain.models.heads.StackedLinearClsHead(num_classes, in_channels, mid_channels, dropout_rate=0.0, norm_cfg=None, act_cfg={'type': 'ReLU'}, **kwargs)[source]

Classifier head with several hidden fc layer and a output fc layer.

Parameters:
  • num_classes (int) – Number of categories.

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

  • mid_channels (Sequence[int]) – Number of channels in the hidden fc layers.

  • dropout_rate (float) – Dropout rate after each hidden fc layer, except the last layer. Defaults to 0.

  • norm_cfg (dict, optional) – Config dict of normalization layer after each hidden fc layer, except the last layer. Defaults to None.

  • act_cfg (dict, optional) – Config dict of activation function after each hidden layer, except the last layer. Defaults to use “ReLU”.

property fc

Full connected layer.

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.