You are reading the documentation for MMClassification 0.x, which will soon be deprecated at the end of 2022. We recommend you upgrade to MMClassification 1.0 to enjoy fruitful new features and better performance brought by OpenMMLab 2.0. Check the installation tutorial, migration tutorial and changelog for more details.


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

  • 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.


Defines the computation performed at every call.

Should be overridden by all subclasses.


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: master
On Read the Docs
Project Home

Free document hosting provided by Read the Docs.