RepVGG¶
- class mmpretrain.models.backbones.RepVGG(arch, in_channels=3, base_channels=64, out_indices=(3,), strides=(2, 2, 2, 2), dilations=(1, 1, 1, 1), frozen_stages=-1, conv_cfg=None, norm_cfg={'type': 'BN'}, act_cfg={'type': 'ReLU'}, with_cp=False, deploy=False, norm_eval=False, add_ppf=False, init_cfg=[{'type': 'Kaiming', 'layer': ['Conv2d']}, {'type': 'Constant', 'val': 1, 'layer': ['_BatchNorm', 'GroupNorm']}])[source]¶
RepVGG backbone.
A PyTorch impl of : RepVGG: Making VGG-style ConvNets Great Again
- Parameters:
RepVGG architecture. If use string, choose from ‘A0’, ‘A1`’, ‘A2’, ‘B0’, ‘B1’, ‘B1g2’, ‘B1g4’, ‘B2’, ‘B2g2’, ‘B2g4’, ‘B3’, ‘B3g2’, ‘B3g4’ or ‘D2se’. If use dict, it should have below keys:
num_blocks (Sequence[int]): Number of blocks in each stage.
width_factor (Sequence[float]): Width deflator in each stage.
group_layer_map (dict | None): RepVGG Block that declares the need to apply group convolution.
se_cfg (dict | None): SE Layer config.
stem_channels (int, optional): The stem channels, the final stem channels will be
min(stem_channels, base_channels*width_factor[0])
. If not set here, 64 is used by default in the code.
in_channels (int) – Number of input image channels. Defaults to 3.
base_channels (int) – Base channels of RepVGG backbone, work with width_factor together. Defaults to 64.
out_indices (Sequence[int]) – Output from which stages. Defaults to
(3, )
.strides (Sequence[int]) – Strides of the first block of each stage. Defaults to
(2, 2, 2, 2)
.dilations (Sequence[int]) – Dilation of each stage. Defaults to
(1, 1, 1, 1)
.frozen_stages (int) – Stages to be frozen (all param fixed). -1 means not freezing any parameters. Defaults to -1.
conv_cfg (dict | None) – The config dict for conv layers. Defaults to None.
norm_cfg (dict) – The config dict for norm layers. Defaults to
dict(type='BN')
.act_cfg (dict) – Config dict for activation layer. Defaults to
dict(type='ReLU')
.with_cp (bool) – Use checkpoint or not. Using checkpoint will save some memory while slowing down the training speed. Defaults to False.
deploy (bool) – Whether to switch the model structure to deployment mode. Defaults to False.
norm_eval (bool) – Whether to set norm layers to eval mode, namely, freeze running stats (mean and var). Note: Effect on Batch Norm and its variants only. Defaults to False.
add_ppf (bool) – Whether to use the MTSPPF block. Defaults to False.
init_cfg (dict or list[dict], optional) – Initialization config dict. Defaults to None.