Home

Awesome

ModelZoo for Pytorch

This is a model zoo project under Pytorch. In this repo I will implement some of basic classification models which have good performance on ImageNet. Then I will train them in most fair way as possible and try my best to get SOTA model on ImageNet. In this repo I'll only consider FP16.

Usage

Environment

Requirement

LMDB Dataset

If you found any IO bottleneck please use LMDB format dataset. A good way is try both and find out which is more faster.

I provide conversion script here.

Train script

python distribute_train_script --params

Here is a example

python distribute_train_script.py --data-path /s4/piston/ImageNet --batch-size 256 --dtype float16 \
                                  -j 48 --epochs 360 --lr 2.6 --warmup-epochs 5 --label-smoothing \
                                  --no-wd --wd 0.00003 --model GhostNet --log-interval 150 --model-info \
                                  --dist-url tcp://127.0.0.1:26548 --world-size 1 --rank 0

ToDo

Baseline models

modelepochsdtypebatch size*gpuslrtricksParams(M)/FLOPstop1/top5params/logs
resnet50120FP1612880.4-25.6/4.1G77.36/-Google Drive
resnet101120FP1612880.4-44.7/7.8G79.13/94.38Google Drive
resnet50v2120FP1612880.4-25.6/4.1G77.06/93.44Google Drive
resnet101v2120FP1612880.4-44.6/7.8G78.90/94.39Google Drive
ResNext50_32x4d120FP1612880.4-25.1/4.2G79.00/94.39
RegNetX4_0GF120FP1612880.4-22.2/4.0G78.40/94.04
RegNetY4_0GF120FP1612880.4-22.1/4.0G79.22/94.57
RegNetY6_4GF120FP1612880.4-31.2/6.4G79.69/94.82
ResNeST50120FP1612880.4-27.5/4.1G78.62/94.28
mobilenetv1150FP1625680.4-4.3/572.2M72.17/90.70Google Drive
mobilenetv2150FP1625680.4-3.5/305.3M71.94/90.59Google Drive
mobilenetv3 Large360FP1625682.6Label smoothing No decay bias Dropout5.5/219M75.64/92.61Google Drive
mobilenetv3 Small360FP1625682.6Label smoothing No decay bias Dropout3.0/57.8M67.83/87.78
GhostNet1.3360FP1640082.6Label smoothing No decay bias Dropout7.4/230.4M75.78/92.77Google Drive

Optimized Models(with tricks)

Ablation Study on Tricks

Here are lots of tricks to improve accuracy during this years.(If you have another idea please open an issue.) I want to verify them in a fair way.

Tricks: RandomRotation, OctConv[14], Drop out, Label Smoothing[4], Sync BN, SwitchNorm[6], Mixup[17], no decay bias[7], Cutout[5], Relu6[18], swish activation[10], Stochastic Depth[9], Lookahead Optimizer[11], Pre-active(ResnetV2)[12], DCNv2[13], LIP[16].

Special: Zero-initialize the last BN, just call it 'Zero γ', only for post-active model.

I'll only use 120 epochs and 128*8 batch size to train them. I know some tricks may need train more time or larger batch size but it's not fair for others. You can think of it as a performance in the current situation.

modelepochsdtypebatch size*gpuslrtricksdegreetop1/top5improveparams/logs
resnet50120FP1612880.4--77.36/-baselineGoogle Drive
resnet50120FP1612880.4Label smoothingsmoothing=0.177.78/93.80+0.42Google Drive
resnet50120FP1612880.4No decay bias-77.28/93.61-0.08Google Drive
resnet50120FP1612880.4Sync BN-77.31/93.49-0.05Google Drive
resnet50120FP1612880.4Mixupalpha=0.277.49/93.73+0.13missing
resnet50120FP1612880.4RandomRotationdegree=1576.64/93.28-1.15Google Drive
resnet50120FP1612880.4Cutoutread code77.44/93.62+0.08Google Drive
resnet50120FP1612880.4Dropoutrate=0.377.11/93.58-0.25Google Drive
resnet50120FP1612880.4Lookahead-SGD-77.23/93.39-0.13Google Drive
resnet50v2120FP1612880.4pre-active-77.06/93.44-0.30Google Drive
oct_resnet50120FP1612880.4OctConvalpha=0.125--
resnet50120FP1612880.4Relu677.28/93.5-0.08Google Drive
resnet50120FP1612880.4-77.00/-DDP baseline
resnet50120FP1612880.4Gradient CentralizationConv only77.40/93.57+0.40
resnet50120FP1612880.4Zero γ77.24/-+0.24
resnet50120FP1612880.4No decay bias77.74/93.77+0.74
resnet50120FP1612880.4RandAugmentn=2,m=976.44/93.18-0.96
resnet50120FP1612880.4AutoAugment76.50/93.23-0.50

Citation

@misc{ModelZoo.pytorch,
  title = {Basic deep conv neural network reproduce and explore},
  author = {X.Yang},
  URL = {https://github.com/PistonY/ModelZoo.pytorch},
  year = {2019}
  }

Reference