All models

repvgg_b2g4

Trains as a multi-branch network, runs as a plain stack of 3x3 convolutions and ReLU.

Image classification · 429 operations Checked

100%

Showing the top corner; full diagram not loaded yetShowing a small copy; full diagram not loaded yetLarge diagram, not loaded yet

Open SVG

Loading diagram (19 KB)

Open in a new tab

Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.

At a glance

Family
RepVGG
Parameters
61.8M
Operations
429
Framework
PyTorch
Recurrent
No
Published
CVPR (arXiv 2021)
Authors
Xiaohan Ding, Xiangyu Zhang, Ningning Ma and others
License
Apache-2.0
Checked
Passed: the trace was replayed operation by operation and matched the model's own output for this input.

Files

The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.

Details
Stable ID
m8787
Graph hash
1a9df0efb0f90dcce23bf15b990edb8f530911a6ba044a1d29efbb0683247e71
Skeleton hash
d72e45461af64c1ca0499d87e82b346f3267a4236521ba9b562aa2fb28f81e2d
Architecture hash
8a8eecc87fc43a46a0acbbd04b44ed27110c5e3c55436da3790b402dcab9664c
Diagram SHA-256
682d5b449bf53d6dba4c8578917aa0d8ccbdd4019244f9462b482a2745fc519e
TorchLens version
2.35.3
Renderer
graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
Check
Forward pass replayed in PyTorch

How this diagram was made

timm.create_model('repvgg_b2g4', pretrained=False)

What it is

About this model's family

RepVGG is a convolutional network whose inference-time body is nothing but a stack of 3 × 3 convolution and ReLU, VGG-style, while the training-time model has a multi-branch topology. That decoupling is done by structural re-parameterization, which is where the name comes from. The motivation is that complicated multi-branch designs like residual addition in ResNet and branch concatenation in Inception make a model hard to implement and customize, slow down inference and reduce memory utilization.

During training, RepVGG uses identity and 1×1 branches inspired by ResNet, but arranged so that the branches can be removed afterwards. After training, simple algebra folds the identity branch, viewed as a degraded 1×1 conv, and the 1×1 branch, viewed as a degraded 3 × 3 conv, into a single 3 × 3 kernel. A body with one operator type, 3 × 3 conv followed by ReLU, makes RepVGG fast on generic computing devices like GPUs.

The network has 5 stages and downsamples with a stride-2 convolution at the beginning of each stage. RepVGG-A puts 1, 2, 4, 14, 1 layers in its five stages, and RepVGG-B is deeper, with 2 more layers in stages 2, 3 and 4. Widths come from uniformly scaling the classic [64, 128, 256, 512] setting with a multiplier a for the first four stages and b for the last. The g4 suffix on the captured repvgg_b1g4, repvgg_b2g4 and repvgg_b3g4 marks interleaved groupwise layers.

On ImageNet, RepVGG-A0 is 1.25% and 33% better than ResNet-18 in accuracy and speed. With groupwise layers, RepVGG-B1g4 is 0.37%/101% better than ResNet-101. Trained for 200 epochs, RepVGG models pass 80% top-1 accuracy, which the authors describe as the first time for plain models to catch up with the state of the art, to the best of their knowledge. In timm, the captured repvgg_a0 through repvgg_d2se are built on the ByobNet framework, with the original weights remapped and accuracies verified. The paper also uses RepVGG as a PSPNet backbone for semantic segmentation on Cityscapes.

Key idea. RepVGG uses structural re-parameterization to decouple a training-time multi-branch topology from an inference-time plain stack of 3 × 3 conv and ReLU.

  • repvgg
  • rep vgg
  • structural re-parameterization
  • reparameterization
  • making vgg-style convnets great again
  • repvgg_a0
  • repvgg_b1g4
  • repvgg_d2se
  • megvii
  • image classification
  • plain convnet

AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.

Cite the paper

@misc{ding2021repvggmakingvggstyleconvnets,
      title={RepVGG: Making VGG-style ConvNets Great Again}, 
      author={Xiaohan Ding and Xiangyu Zhang and Ningning Ma and Jungong Han and Guiguang Ding and Jian Sun},
      year={2021},
      eprint={2101.03697},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2101.03697}, 
}