Shortcuts

RepMLPNet

class mmcls.models.RepMLPNet(arch, img_size=224, in_channels=3, patch_size=4, out_indices=(3,), reparam_conv_kernels=(3,), globalperceptron_ratio=4, conv_cfg=None, norm_cfg={'requires_grad': True, 'type': 'BN'}, patch_cfg={}, final_norm=True, deploy=False, init_cfg=None)[source]

RepMLPNet backbone.

A PyTorch impl of : RepMLP: Re-parameterizing Convolutions into Fully-connected Layers for Image Recognition

Parameters
  • arch (str | dict) –

    RepMLP architecture. If use string, choose from ‘base’ and ‘b’. If use dict, it should have below keys:

    • channels (List[int]): Number of blocks in each stage.

    • depths (List[int]): The number of blocks in each branch.

    • sharesets_nums (List[int]): RepVGG Block that declares the need to apply group convolution.

  • img_size (int | tuple) – The size of input image. Defaults: 224.

  • in_channels (int) – Number of input image channels. Default: 3.

  • patch_size (int | tuple) – The patch size in patch embedding. Defaults to 4.

  • out_indices (Sequence[int]) – Output from which stages. Default: (3, ).

  • reparam_conv_kernels (Squeue(int) | None) – The conv kernels in the GlobalPerceptron. Default: None.

  • globalperceptron_ratio (int) – The reducation ratio in the GlobalPerceptron. Default: 4.

  • num_sharesets (int) – The number of sharesets in the PartitionPerceptron. Default 1.

  • conv_cfg (dict | None) – The config dict for conv layers. Default: None.

  • norm_cfg (dict) – The config dict for norm layers. Default: dict(type=’BN’, requires_grad=True).

  • patch_cfg (dict) – Extra config dict for patch embedding. Defaults to an empty dict.

  • final_norm (bool) – Whether to add a additional layer to normalize final feature map. Defaults to True.

  • act_cfg (dict) – Config dict for activation layer. Default: dict(type=’ReLU’).

  • deploy (bool) – Whether to switch the model structure to deployment mode. Default: False.

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

forward(x)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

Read the Docs v: latest
Versions
master
latest
1.x
dev-1.x
Downloads
html
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.