RepVGG¶
The ResNet model is based on the "RepVGG: Making VGG-style ConvNets Great Again" paper.
Architecture overview¶
This paper revisits the VGG architecture by adapting its parameter setting in training and inference mode to combine the original VGG speed and the block design of ResNet.

The key takeaways from the paper are the following:
- have different block architectures between training and inference modes
- the block is designed in a similar fashion as a ResNet bottleneck but in a way that all branches can be fused into a single one
- The more complex training architecture improves gradient flow and overall optimization, while its inference counterpart is optimized for minimum latency and memory usage
Model builders¶
The following model builders can be used to instantiate a RepVGG model, with or
without pre-trained weights. All the model builders internally rely on the
RepVGG base class.
RepVGG
¶
RepVGG(num_blocks: list[int], planes: list[int], width_multiplier: float, final_width_multiplier: float, num_classes: int = 10, in_channels: int = 3, act_layer: Module | None = None, norm_layer: Callable[[int], Module] | None = None)
Bases: Sequential
Implements a reparametrized version of VGG as described in
"RepVGG: Making VGG-style ConvNets Great Again" <https://arxiv.org/pdf/2101.03697.pdf>_
| PARAMETER | DESCRIPTION |
|---|---|
num_blocks
|
list of number of blocks per stage |
planes
|
list of output channels of each stage |
width_multiplier
|
multiplier for the output channels of all stages apart from the last
TYPE:
|
final_width_multiplier
|
multiplier for the output channels of the last stage
TYPE:
|
num_classes
|
number of output classes
TYPE:
|
in_channels
|
number of input channels
TYPE:
|
act_layer
|
the activation layer to use
TYPE:
|
norm_layer
|
the normalization layer to use |
Source code in holocron/models/classification/repvgg.py
reparametrize
¶
Reparametrize the block by fusing convolutions and BN in each branch, then fusing all branches
Source code in holocron/models/classification/repvgg.py
repvgg_a0
¶
repvgg_a0(pretrained: bool = False, checkpoint: Checkpoint | None = None, progress: bool = True, **kwargs: Any) -> RepVGG
RepVGG-A0 from "RepVGG: Making VGG-style ConvNets Great Again"
| PARAMETER | DESCRIPTION |
|---|---|
pretrained
|
If True, returns a model pre-trained on ImageNette
TYPE:
|
checkpoint
|
If specified, the model's parameters will be set to the checkpoint's values
TYPE:
|
progress
|
If True, displays a progress bar of the download to stderr
TYPE:
|
kwargs
|
keyword args of
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
RepVGG
|
classification model |
RepVGG_A0_Checkpoint
¶
Bases: Enum
IMAGENETTE
class-attribute
instance-attribute
¶
IMAGENETTE = _checkpoint(arch='repvgg_a0', url='https://github.com/frgfm/Holocron/releases/download/v0.2.1/repvgg_a0_224-d3f54b28.pth', acc1=0.9292, acc5=0.9946, sha256='d3f54b28567fcd7e3e32ffbcffb5bb5c64fd97b7139cba0bfe9ad0bd7765cdaa', size=99183419, num_params=24741642, commit='d4a59999179b42fc0d3058ac6b76cc41f49dd56e', train_args='./imagenette2-320/ --arch repvgg_a0 --batch-size 64 --mixup-alpha 0.2 --amp --device 0 --epochs 100 --lr 1e-3 --label-smoothing 0.1 --random-erase 0.1 --train-crop-size 176 --val-resize-size 232 --opt adamw --weight-decay 5e-2')
Source code in holocron/models/classification/repvgg.py
repvgg_a1
¶
repvgg_a1(pretrained: bool = False, checkpoint: Checkpoint | None = None, progress: bool = True, **kwargs: Any) -> RepVGG
RepVGG-A1 from "RepVGG: Making VGG-style ConvNets Great Again"
| PARAMETER | DESCRIPTION |
|---|---|
pretrained
|
If True, returns a model pre-trained on ImageNette
TYPE:
|
checkpoint
|
If specified, the model's parameters will be set to the checkpoint's values
TYPE:
|
progress
|
If True, displays a progress bar of the download to stderr
TYPE:
|
kwargs
|
keyword args of
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
RepVGG
|
classification model |
RepVGG_A1_Checkpoint
¶
Bases: Enum
IMAGENETTE
class-attribute
instance-attribute
¶
IMAGENETTE = _checkpoint(arch='repvgg_a1', url='https://github.com/frgfm/Holocron/releases/download/v0.2.1/repvgg_a1_224-8d3269fb.pth', acc1=0.9378, acc5=0.9918, sha256='8d3269fb5181c0fe75ef617872238135f3002f41e82e5ef7492d62a402ffae50', size=120724868, num_params=30119946, commit='d4a59999179b42fc0d3058ac6b76cc41f49dd56e', train_args='./imagenette2-320/ --arch repvgg_a1 --batch-size 64 --mixup-alpha 0.2 --amp --device 0 --epochs 100 --lr 1e-3 --label-smoothing 0.1 --random-erase 0.1 --train-crop-size 176 --val-resize-size 232 --opt adamw --weight-decay 5e-2')
Source code in holocron/models/classification/repvgg.py
repvgg_a2
¶
repvgg_a2(pretrained: bool = False, checkpoint: Checkpoint | None = None, progress: bool = True, **kwargs: Any) -> RepVGG
RepVGG-A2 from "RepVGG: Making VGG-style ConvNets Great Again"
| PARAMETER | DESCRIPTION |
|---|---|
pretrained
|
If True, returns a model pre-trained on ImageNette
TYPE:
|
checkpoint
|
If specified, the model's parameters will be set to the checkpoint's values
TYPE:
|
progress
|
If True, displays a progress bar of the download to stderr
TYPE:
|
kwargs
|
keyword args of
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
RepVGG
|
classification model |
RepVGG_A2_Checkpoint
¶
Bases: Enum
IMAGENETTE
class-attribute
instance-attribute
¶
IMAGENETTE = _checkpoint(arch='repvgg_a2', url='https://github.com/frgfm/Holocron/releases/download/v0.2.1/repvgg_a2_224-cb442207.pth', acc1=0.9363, acc5=0.9939, sha256='cb442207d0c4627e3a16d7a8b4bf5342a182fd924cf4a044ac3a832014e7d4cf', size=194822538, num_params=48629514, commit='d4a59999179b42fc0d3058ac6b76cc41f49dd56e', train_args='./imagenette2-320/ --arch repvgg_a2 --batch-size 64 --mixup-alpha 0.2 --amp --device 0 --epochs 100 --lr 1e-3 --label-smoothing 0.1 --random-erase 0.1 --train-crop-size 176 --val-resize-size 232 --opt adamw --weight-decay 5e-2')
Source code in holocron/models/classification/repvgg.py
repvgg_b0
¶
repvgg_b0(pretrained: bool = False, checkpoint: Checkpoint | None = None, progress: bool = True, **kwargs: Any) -> RepVGG
RepVGG-B0 from "RepVGG: Making VGG-style ConvNets Great Again"
| PARAMETER | DESCRIPTION |
|---|---|
pretrained
|
If True, returns a model pre-trained on ImageNette
TYPE:
|
checkpoint
|
If specified, the model's parameters will be set to the checkpoint's values
TYPE:
|
progress
|
If True, displays a progress bar of the download to stderr
TYPE:
|
kwargs
|
keyword args of
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
RepVGG
|
classification model |
RepVGG_B0_Checkpoint
¶
Bases: Enum
IMAGENETTE
class-attribute
instance-attribute
¶
IMAGENETTE = _checkpoint(arch='repvgg_b0', url='https://github.com/frgfm/Holocron/releases/download/v0.2.1/repvgg_b0_224-fdcdd2b7.pth', acc1=0.9269, acc5=0.9921, sha256='fdcdd2b739f19b47572be5a98ec407c08935d02adf1ab0bf90d7bc92c710fe2d', size=127668600, num_params=31845642, commit='d4a59999179b42fc0d3058ac6b76cc41f49dd56e', train_args='./imagenette2-320/ --arch repvgg_b0 --batch-size 64 --mixup-alpha 0.2 --amp --device 0 --epochs 100 --lr 1e-3 --label-smoothing 0.1 --random-erase 0.1 --train-crop-size 176 --val-resize-size 232 --opt adamw --weight-decay 5e-2')
Source code in holocron/models/classification/repvgg.py
repvgg_b1
¶
repvgg_b1(pretrained: bool = False, checkpoint: Checkpoint | None = None, progress: bool = True, **kwargs: Any) -> RepVGG
RepVGG-B1 from "RepVGG: Making VGG-style ConvNets Great Again"
| PARAMETER | DESCRIPTION |
|---|---|
pretrained
|
If True, returns a model pre-trained on ImageNette
TYPE:
|
checkpoint
|
If specified, the model's parameters will be set to the checkpoint's values
TYPE:
|
progress
|
If True, displays a progress bar of the download to stderr
TYPE:
|
kwargs
|
keyword args of
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
RepVGG
|
classification model |
RepVGG_B1_Checkpoint
¶
Bases: Enum
IMAGENETTE
class-attribute
instance-attribute
¶
IMAGENETTE = _checkpoint(arch='repvgg_b1', url='https://github.com/frgfm/Holocron/releases/download/v0.2.1/repvgg_b1_224-3e5b28d7.pth', acc1=0.9396, acc5=0.9939, sha256='3e5b28d7803965546efadeb20abb84d8fef765dd08170677467a9c06294224c4', size=403763795, num_params=100829194, commit='d4a59999179b42fc0d3058ac6b76cc41f49dd56e', train_args='./imagenette2-320/ --arch repvgg_b1 --batch-size 64 --mixup-alpha 0.2 --amp --device 0 --epochs 100 --lr 1e-3 --label-smoothing 0.1 --random-erase 0.1 --train-crop-size 176 --val-resize-size 232 --opt adamw --weight-decay 5e-2')
Source code in holocron/models/classification/repvgg.py
repvgg_b2
¶
repvgg_b2(pretrained: bool = False, checkpoint: Checkpoint | None = None, progress: bool = True, **kwargs: Any) -> RepVGG
RepVGG-B2 from "RepVGG: Making VGG-style ConvNets Great Again"
| PARAMETER | DESCRIPTION |
|---|---|
pretrained
|
If True, returns a model pre-trained on ImageNette
TYPE:
|
checkpoint
|
If specified, the model's parameters will be set to the checkpoint's values
TYPE:
|
progress
|
If True, displays a progress bar of the download to stderr
TYPE:
|
kwargs
|
keyword args of
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
RepVGG
|
classification model |
RepVGG_B2_Checkpoint
¶
Bases: Enum
IMAGENETTE
class-attribute
instance-attribute
¶
IMAGENETTE = _checkpoint(arch='repvgg_b2', url='https://github.com/frgfm/Holocron/releases/download/v0.2.1/repvgg_b2_224-dc810d88.pth', acc1=0.9414, acc5=0.9957, sha256='dc810d889e8533f3ab24d75d8bf4cec84380abfb3b10ee01009997eab6a35d4b', size=630382163, num_params=157462410, commit='d4a59999179b42fc0d3058ac6b76cc41f49dd56e', train_args='./imagenette2-320/ --arch repvgg_b2 --batch-size 32 --grad-acc 2 --mixup-alpha 0.2 --amp --device 0 --epochs 100 --lr 1e-3 --label-smoothing 0.1 --random-erase 0.1 --train-crop-size 176 --val-resize-size 232 --opt adamw --weight-decay 5e-2')