Train CNNs for image classification from scratch.
I post several pretrained weights below.
pytorch 1.4.0+
torchvision
tensorboard 1.14+
numpy
pyyaml
tqdm
pillow
CIFAR-10
CIFAR-100
ImageNet 2012
- Add configuration file under
configs
folder as follows-
cuda: "all" # if not specified, use cpu. or specified as "0", "0,1" model: arch: resnet depth: 50 data: dataset: imagenet train_dir: /PATH/TO/ILSVRC/train val_dir: /PATH/TO/ILSVRC/val workers: 16 training: runid: xxxx # recommended specified during validation and testing epochs: 100 batch_size: 256 loss: name: 'label_smooth' smoothing: 0.1 optimizer: name: 'sgd' lr: 0.1 weight_decay: 0.0001 momentum: 0.9 lr_schedule: name: 'multi_step' milestones: [30,60,90] gamma: 0.1 save_interval: 1 resume: save_model.pkl best_model: best_model.pkl
-
- run
train.py
,validate.py
ortest.py
as follows-
python train.py --config configs/aaaa.yml
-
Architecture | Top-1 error | Params | FLOPs | Pretrained weights |
---|---|---|---|---|
ResNet18 (My Imp.) |
29.72 | 11.69M | 1.82G | Google Drive Baidu Netdisk |
ResNet18 (paper) |
30.43 | - | - | - |
ResNet50 (My Imp.) |
23.30 | 25.56M | 4.11G | Google Drive Baidu Netdisk |
ResNet50 (paper) |
24.7 | - | - | - |
ResNet101 (My Imp.) |
22.18 | 44.55M | 7.84G | Google Drive |
ResNet101 (paper) |
22.44 | - | - | - |
ResNeXt50 (My Imp.) |
22.35 | 25.03M | 4.26G | Google Drive Baidu Netdisk |
ResNeXt50 (paper) |
22.2 | - | - | - |
SE ResNet50 (My Imp.) |
22.64 | 28.09M | 4.12G | Google Drive Baidu Netdisk |
SE ResNet50 (paper) |
23.29 | - | - | - |
CBAM ResNet50 (My Imp.) |
22.40 | 28.07M | 4.13G | Google Drive |
CBAM ResNet50 (paper) |
22.66 | - | - | - |
SKNet50 (My Imp.) |
21.26 | 27.49M | 4.50G | Google Drive Baidu Netdisk |
SKNet50 (paper) |
20.79 | - | - | - |
MobileNet V2 0.5x (My Imp.) |
35.62 | 1.97M | 138.46M | Google Drive |
MobileNet V2 0.5x (paper) |
35.6 | - | - | - |
MobileNet V2 1x (My Imp.) |
28.09 | 3.50M | 315.41M | Google Drive Baidu Netdisk |
MobileNet V2 1x (paper) |
28.0 | - | - | - |
MobileNet V3 large (My Imp.) |
26.79 | 5.48M | 230.05M | Google Drive |
MobileNet V3 large (paper) |
24.8 | - | - | - |
The hyperparameters and settings during my training for ResNet, ResNeXt, SENet, SKNet are the same as the paper, except I use label smooth loss.
And for MobileNet V2 and MobileNet V3, I follow the setup in this project, and use label smooth loss too.
- place the downloaded pretrained model in
runs/aaaa/xxxx
folder under this project, whereaaaa
is the name of configuration file andxxxx
is runid in configuration file. - run
validate.py
ortest.py
as above.