basecls.models.repvgg#

RepVGG Series

RegVGG: “RepVGG: Making VGG-style ConvNets Great Again”

引用

DingXiaoH/RepVGG

class basecls.models.repvgg.RepVGGBlock(w_in, w_out, stride=1, groups=1, se_r=0.0, act_name='relu', deploy=False)[源代码]#

基类:Module

RepVGG Reparamed Block.

参数
  • w_in (int) – number of input channels.

  • w_out (int) – number of output channels.

  • stride (int) – stride of the 2D conv. Default: 1

  • groups (int) – number of groups of the 2D conv. Default: 1

  • se_r (float) – Squeeze-and-Excitation (SE) ratio. Default: 0.0

  • act_name (str) – activation function. Default: "relu"

  • deploy (bool) – fuse branches into a plain Conv2d layer. Default: False

forward(inputs)[源代码]#
classmethod convert_to_deploy(module)[源代码]#

Convert/fuse reparameterized RepvggBlock for deploy

返回类型

Module

class basecls.models.repvgg.RepVGG(num_blocks, width_multiplier, head=None, groups=1, se_r=0.0, act_name='relu', deploy=False)[源代码]#

基类:Module

RepVGG Model.

Use RepVGG.convert_to_deploy() to convert a training RepVGG to deploy:

model = RepVGG(..., deploy=False)
model.load_state_dict(...)
_ = RepVGG.convert_to_deploy(model)
参数
  • num_blocks (Sequence[int]) – RepVGG depths.

  • width_multiplier (Sequence[int]) – RepVGG widths, base_width is [64, 128, 256, 512].

  • head (Optional[Mapping[str, Any]]) – head args. Default: None

  • groups (Union[int, List[Union[int, List[int]]]]) – number of groups for blocks. Default: 1

  • se_r (float) – Squeeze-and-Excitation (SE) ratio. Default: 0.0

  • act_name (str) – activation function. Default: "relu"

  • deploy (bool) – switch a reparamed RepVGG into deploy mode. Default: False

forward(x)[源代码]#
classmethod convert_to_deploy(module)[源代码]#
返回类型

Module