备注
您正在阅读 MMClassification 0.x 版本的文档。MMClassification 0.x 会在 2022 年末被切换为次要分支。建议您升级到 MMClassification 1.0 版本,体验更多新特性和新功能。请查阅 MMClassification 1.0 的安装教程、迁移教程以及更新日志。
mmcls.models.RepVGG¶
- class mmcls.models.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']}])[源代码]¶
RepVGG backbone.
A PyTorch impl of : RepVGG: Making VGG-style ConvNets Great Again
- 参数
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. Default: 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. Default: (3, ).
strides (Sequence[int]) – Strides of the first block of each stage. Default: (2, 2, 2, 2).
dilations (Sequence[int]) – Dilation of each stage. Default: (1, 1, 1, 1).
frozen_stages (int) – Stages to be frozen (all param fixed). -1 means not freezing any parameters. 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’).
act_cfg (dict) – Config dict for activation layer. Default: dict(type=’ReLU’).
with_cp (bool) – Use checkpoint or not. Using checkpoint will save some memory while slowing down the training speed. Default: False.
deploy (bool) – Whether to switch the model structure to deployment mode. Default: 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. Default: False.
add_ppf (bool) – Whether to use the MTSPPF block. Default: False.
init_cfg (dict or list[dict], optional) – Initialization config dict.