zhangrui_wolf 90496b4687
[Feature] Add RepVGG backbone and checkpoints. (#414)
* Add RepVGG code.

* Add se_module as plugin.

* Add the repvggA0 primitive config

* Change repvggA0.py to fit mmcls

* Add RepVGG configs

* Add repvgg_to_mmcls

* Add tools/deployment/convert_repvggblock_param_to_deploy.py

* Change configs/repvgg/README.md

* Streamlining the number of configuration files.

* Fix lints

* Delete plugins

* Delete code about plugin.

* Modify the code for using se module.

* Modify config to fit repvgg with se.

* Change se_cfg to allow loading of pre-training parameters.

* Reduce the complexity of the configuration file.

* Finsh unitest for repvgg.

* Fix bug about se in repvgg_to_mmcls.

* Rename convert_repvggblock_param_to_deploy.py to reparameterize_repvgg.py, and delete setting about device.

* test commit

* test commit

* test commit command

* Modify repvgg.py to make the code more readable.

* Add value=0 in F.pad()

* Add se_cfg to arch_settings.

* Fix bug.

* modeify some attr name and Update unit tests

* rename stage_0 to stem and branch_identity to branch_norm

* update unit tests

* add m.eval in unit tests

* [Enhance] Enhence SE layer to support custom squeeze channels. (#417)

* add enhenced SE

* Update

* rm basechannel

* fix docstring

* Update se_layer.py

fix docstring

* [Docs] Add algorithm readme and update meta yml (#418)

* Add README.md for models without checkpoints.

* Update model-index.yml

* Update metafile.yml of seresnet

* [Enhance] Add `hparams` argument in `AutoAugment` and `RandAugment` and some other improvement. (#398)

* Add hparams argument in `AutoAugment` and `RandAugment`.

And `pad_val` supports sequence instead of tuple only.

* Add unit tests for `AutoAugment` and `hparams` in `RandAugment`.

* Use smaller test image to speed up uni tests.

* Use hparams to simplify RandAugment config in swin-transformer.

* Rename augment config name from `pipeline` to `pipelines`.

* Add some commnet ad docstring.

* [Feature] Support classwise weight in losses (#388)

* Add classwise weight in losses:CE,BCE,softBCE

* Update unit test

* rm some extra code

* rm some extra code

* fix broadcast

* fix broadcast

* update unit tests

* use new_tensor

* fix lint

* [Enhance] Better result visualization (#419)

* Imporve result visualization to support wait time and change the backend
to matplotlib.

* Add unit test for visualization

* Add adaptive dpi function

* Rename `imshow_cls_result` to `imshow_infos`.

* Support str in `imshow_infos`

* Improve docstring.

* Bump version to v0.15.0 (#426)

* [CI] Add PyTorch 1.9 and Python 3.9 build workflow, and remove some CI. (#422)

* Add PyTorch 1.9 build workflow, and remove some CI.

* Add Python 3.9 CI

* Show Python 3.9 support.

* [Enhance] Rename the option `--options` in some tools to `--cfg-options`. (#425)

* [Docs] Fix sphinx version (#429)

* [Docs] Add `CITATION.cff` (#428)

* Add CITATION.cff

* Fix typo in setup.py

* Change author in setup.py

* modeify some attr name and Update unit tests

* rename stage_0 to stem and branch_identity to branch_norm

* update unit tests

* add m.eval in unit tests

* Update unit tests

* refactor

* refactor

* Alignment inference accuracy

* Update configs, readme and metafile

* Update readme

* return tuple and fix metafile

* fix unit test

* rm regnet and classifiers changes

* update auto_aug

* update metafile & readme

* use delattr

* rename cfgs

* Update checkpoint url

* Update readme

* Rename config files.

* Update readme and metafile

* add comment

* Update mmcls/models/backbones/repvgg.py

Co-authored-by: Ma Zerun <mzr1996@163.com>

* Update docstring

* Improve docstring.

* Update unittest_testblock

Co-authored-by: Ezra-Yu <1105212286@qq.com>
Co-authored-by: Ma Zerun <mzr1996@163.com>
2021-09-29 11:06:23 +08:00
..

Repvgg: Making vgg-style convnets great again

Introduction

@inproceedings{ding2021repvgg,
  title={Repvgg: Making vgg-style convnets great again},
  author={Ding, Xiaohan and Zhang, Xiangyu and Ma, Ningning and Han, Jungong and Ding, Guiguang and Sun, Jian},
  booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  pages={13733--13742},
  year={2021}
}

Pretrain model

Model Epochs Params(M) Flops(G) Top-1 (%) Top-5 (%) Config Download
RepVGG-A0 120 9.11train) | 8.31 (deploy) 1.52 (train) | 1.36 (deploy) 72.41 90.50 config (train) | config (deploy) model
RepVGG-A1 120 14.09 (train) | 12.79 (deploy) 2.64 (train) | 2.37 (deploy) 74.47 91.85 config (train) | config (deploy) model
RepVGG-A2 120 28.21 (train) | 25.5 (deploy) 5.7 (train) | 5.12 (deploy) 76.48 93.01 config (train) |config (deploy) model
RepVGG-B0 120 15.82 (train) | 14.34 (deploy) 3.42 (train) | 3.06 (deploy) 75.14 92.42 config (train) |config (deploy) model
RepVGG-B1 120 57.42 (train) | 51.83 (deploy) 13.16 (train) | 11.82 (deploy) 78.37 94.11 config (train) |config (deploy) model
RepVGG-B1g2 120 45.78 (train) | 41.36 (deploy) 9.82 (train) | 8.82 (deploy) 77.79 93.88 config (train) |config (deploy) model
RepVGG-B1g4 120 39.97 (train) | 36.13 (deploy) 8.15 (train) | 7.32 (deploy) 77.58 93.84 config (train) |config (deploy) model
RepVGG-B2 120 89.02 (train) | 80.32 (deploy) 20.46 (train) | 18.39 (deploy) 78.78 94.42 config (train) |config (deploy) model
RepVGG-B2g4 200 61.76 (train) | 55.78 (deploy) 12.63 (train) | 11.34 (deploy) 79.38 94.68 config (train) |config (deploy) model
RepVGG-B3 200 123.09 (train) | 110.96 (deploy) 29.17 (train) | 26.22 (deploy) 80.52 95.26 config (train) |config (deploy) model
RepVGG-B3g4 200 83.83 (train) | 75.63 (deploy) 17.9 (train) | 16.08 (deploy) 80.22 95.10 config (train) |config (deploy) model
RepVGG-D2se 200 133.33 (train) | 120.39 (deploy) 36.56 (train) | 32.85 (deploy) 81.81 95.94 config (train) |config (deploy) model

Reparameterize RepVGG

The checkpoints provided are all in train form. Use the reparameterize tool to switch them to more efficient deploy form, which not only has fewer parameters but also less calculations.

python ./tools/convert_models/reparameterize_repvgg.py ${CFG_PATH} ${SRC_CKPT_PATH} ${TARGET_CKPT_PATH}

${CFG_PATH} is the config file, ${SRC_CKPT_PATH} is the source chenpoint file, ${TARGET_CKPT_PATH} is the target deploy weight file path.

To use reparameterized repvgg weight, the config file must switch to the deploy config files as below:

python ./tools/test.py ${RapVGG_Deploy_CFG} ${CHECK_POINT}