Shortcuts

SwAVNeck

class mmpretrain.models.necks.SwAVNeck(in_channels, hid_channels, out_channels, with_avg_pool=True, with_l2norm=True, norm_cfg={'type': 'SyncBN'}, init_cfg=[{'type': 'Constant', 'val': 1, 'layer': ['_BatchNorm', 'GroupNorm']}])[源代码]

The non-linear neck of SwAV: fc-bn-relu-fc-normalization.

参数:
  • in_channels (int) – Number of input channels.

  • hid_channels (int) – Number of hidden channels.

  • out_channels (int) – Number of output channels.

  • with_avg_pool (bool) – Whether to apply the global average pooling after backbone. Defaults to True.

  • with_l2norm (bool) – whether to normalize the output after projection. Defaults to True.

  • norm_cfg (dict) – Dictionary to construct and config norm layer. Defaults to dict(type=’SyncBN’).

  • init_cfg (dict or list[dict], optional) – Initialization config dict.

forward(x)[源代码]

Forward function.

参数:

x (List[torch.Tensor]) – list of feature maps, len(x) according to len(num_crops).

返回:

The projection vectors.

返回类型:

torch.Tensor

forward_projection(x)[源代码]

Compute projection.

参数:

x (torch.Tensor) – The feature vectors after pooling.

返回:

The output features with projection or L2-norm.

返回类型:

torch.Tensor

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.