Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
P

pytorch_image_classification

> DevOps
Open source

PyTorch implementation of image classification models for CIFAR-10/CIFAR-100/MNIST/FashionMNIST/Kuzushiji-MNIST/ImageNet

1.4K stars0 likes0 views
WebsiteGitHub

About

PyTorch implementation of image classification models for CIFAR-10/CIFAR-100/MNIST/FashionMNIST/Kuzushiji-MNIST/ImageNet

PyTorch Image Classification

Following papers are implemented using PyTorch.

  • ResNet (1512.03385)
  • ResNet-preact (1603.05027)
  • WRN (1605.07146)
  • DenseNet (1608.06993, 2001.02394)
  • PyramidNet (1610.02915)
  • ResNeXt (1611.05431)
  • shake-shake (1705.07485)
  • LARS (1708.03888, 1801.03137)
  • Cutout (1708.04552)
  • Random Erasing (1708.04896)
  • SENet (1709.01507)
  • Mixup (1710.09412)
  • Dual-Cutout (1802.07426)
  • RICAP (1811.09030)
  • CutMix (1905.04899)

Requirements

  • Ubuntu (It's only tested on Ubuntu, so it may not work on Windows.)
  • Python >= 3.7
  • PyTorch >= 1.4.0
  • torchvision
  • NVIDIA Apex
bash
pip install -r requirements.txt

Usage

bash
python train.py --config configs/cifar/resnet_preact.yaml

Results on CIFAR-10

Results using almost same settings as papers

Model Test Error (median of 3 runs) Test Error (in paper) Training Time
VGG-like (depth 15, w/ BN, channel 64) 7.29 N/A 1h20m
ResNet-110 6.52 6.43 (best), 6.61 +/- 0.16 3h06m
ResNet-preact-110 6.47 6.37 (median of 5 runs) 3h05m
ResNet-preact-164 bottleneck 5.90 5.46 (median of 5 runs) 4h01m
ResNet-preact-1001 bottleneck 4.62 (median of 5 runs), 4.69 +/- 0.20
WRN-28-10 4.03 4.00 (median of 5 runs) 16h10m
WRN-28-10 w/ dropout 3.89 (median of 5 runs)
DenseNet-100 (k=12) 3.87 (1 run) 4.10 (1 run) 24h28m*
DenseNet-100 (k=24) 3.74 (1 run)
DenseNet-BC-100 (k=12) 4.69 4.51 (1 run) 15h20m
DenseNet-BC-250 (k=24) 3.62 (1 run)
DenseNet-BC-190 (k=40) 3.46 (1 run)
PyramidNet-110 (alpha=84) 4.40 4.26 +/- 0.23 11h40m
PyramidNet-110 (alpha=270) 3.92 (1 run) 3.73 +/- 0.04 24h12m*
PyramidNet-164 bottleneck (alpha=270) 3.44 (1 run) 3.48 +/- 0.20 32h37m*
PyramidNet-272 bottleneck (alpha=200) 3.31 +/- 0.08
ResNeXt-29 4x64d 3.89 ~3.75 (from Figure 7) 31h17m
ResNeXt-29 8x64d 3.97 (1 run) 3.65 (average of 10 runs) 42h50m*
ResNeXt-29 16x64d 3.58 (average of 10 runs)
shake-shake-26 2x32d (S-S-I) 3.68 3.55 (average of 3 runs) 33h49m
shake-shake-26 2x64d (S-S-I) 2.88 (1 run) 2.98 (average of 3 runs) 78h48m
shake-shake-26 2x96d (S-S-I) 2.90 (1 run) 2.86 (average of 5 runs) 101h32m*

Notes

  • Differences with papers in training settings:
    • Trained WRN-28-10 with batch size 64 (128 in paper).
    • Trained DenseNet-BC-100 (k=12) with batch size 32 and initial learning rate 0.05 (batch size 64 and initial learning rate 0.1 in paper).
    • Trained ResNeXt-29 4x64d with a single GPU, batch size 32 and initial learning rate 0.025 (8 GPUs, batch size 128 and initial learning rate 0.1 in paper).
    • Trained shake-shake models with a single GPU (2 GPUs in paper).
    • Trained shake-shake 26 2x64d (S-S-I) with batch size 64, and initial learning rate 0.1.
  • Test errors reported above are the ones at last epoch.
  • Experiments with only 1 run are done on different computer from the one used for experiments with 3 runs.
  • GeForce GTX 980 was used in these experiments.

VGG-like

bash
python train.py --config configs/cifar/vgg.yaml

ResNet

bash
python train.py --config configs/cifar/resnet.yaml

ResNet-preact

bash
python train.py --config configs/cifar/resnet_preact.yaml \
    train.output_dir experiments/resnet_preact_basic_110/exp00
bash
python train.py --config configs/cifar/resnet_preact.yaml \
    model.resnet_preact.depth 164 \
    model.resnet_preact.block_type bottleneck \
    train.output_dir experiments/resnet_preact_bottleneck_164/exp00

WRN

bash
python train.py --config configs/cifar/wrn.yaml

DenseNet

bash
python train.py --config configs/cifar/densenet.yaml

PyramidNet

bash
python train.py --config configs/cifar/pyramidnet.yaml \
    model.pyramidnet.depth 110 \
    model.pyramidnet.block_type basic \
    model.pyramidnet.alpha 84 \
    train.output_dir experiments/pyramidnet_basic_110_84/exp00
bash
python train.py --config configs/cifar/pyramidnet.yaml \
    model.pyramidnet.depth 110 \
    model.pyramidnet.block_type basic \
    model.pyramidnet.alpha 270 \
    train.output_dir experiments/pyramidnet_basic_110_270/exp00

ResNeXt

bash
python train.py --config configs/cifar/resnext.yaml \
    model.resnext.cardinality 4 \
    train.batch_size 32 \
    train.base_lr 0.025 \
    train.output_dir experiments/resnext_29_4x64d/exp00
bash
python train.py --config configs/cifar/resnext.yaml \
    train.batch_size 64 \
    train.base_lr 0.05 \
    train.output_dir experiments/resnext_29_8x64d/exp00

shake-shake

bash
python train.py --config configs/cifar/shake_shake.yaml \
    model.shake_shake.initial_channels 32 \
    train.output_dir experiments/shake_shake_26_2x32d_SSI/exp00
bash
python train.py --config configs/cifar/shake_shake.yaml \
    model.shake_shake.initial_channels 64 \
    train.batch_size 64 \
    train.base_lr 0.1 \
    train.output_dir experiments/shake_shake_26_2x64d_SSI/exp00
bash
python train.py --config configs/cifar/shake_shake.yaml \
    model.shake_shake.initial_channels 96 \
    train.batch_size 64 \
    train.base_lr 0.1 \
    train.output_dir experiments/shake_shake_26_2x96d_SSI/exp00

Results

Model Test Error (1 run) # of Epochs Training Time
ResNet-preact-20, widening factor 4 4.91 200 1h26m
ResNet-preact-20, widening factor 4 4.01 400 2h53m
ResNet-preact-20, widening factor 4 3.99 1800 12h53m
ResNet-preact-20, widening factor 4, Cutout 16 3.71 200 1h26m
ResNet-preact-20, widening factor 4, Cutout 16 3.46 400 2h53m
ResNet-preact-20, widening factor 4, Cutout 16 3.76 1800 12h53m
ResNet-preact-20, widening factor 4, RICAP (beta=0.3) 3.45 200 1h26m
ResNet-preact-20, widening factor 4, RICAP (beta=0.3) 3.11 400 2h53m
ResNet-preact-20, widening factor 4, RICAP (beta=0.3) 3.15 1800 12h53m
Model Test Error (1 run) # of Epochs Training Time
WRN-28-10, Cutout 16 3.19 200 6h35m
WRN-28-10, mixup (alpha=1) 3.32 200 6h35m
WRN-28-10, RICAP (beta=0.3) 2.83 200 6h35m
WRN-28-10, Dual-Cutout (alpha=0.1) 2.87 200 12h42m
WRN-28-10, Cutout 16 3.07 400 13h10m
WRN-28-10, mixup (alpha=1) 3.04 400 13h08m
WRN-28-10, RICAP (beta=0.3) 2.71 400 13h08m
WRN-28-10, Dual-Cutout (alpha=0.1) 2.76 400 25h20m
shake-shake-26 2x64d, Cutout 16 2.64 1800 78h55m*
shake-shake-26 2x64d, mixup (alpha=1) 2.63 1800 35h56m
shake-shake-26 2x64d, RICAP (beta=0.3) 2.29 1800 35h10m
shake-shake-26 2x64d, Dual-Cutout (alpha=0.1) 2.64 1800 68h34m
shake-shake-26 2x96d, Cutout 16 2.50 1800 60h20m
shake-shake-26 2x96d, mixup (alpha=1) 2.36 1800 60h20m
shake-shake-26 2x96d, RICAP (beta=0.3) 2.10 1800 60h20m
shake-shake-26 2x96d, Dual-Cutout (alpha=0.1) 2.41 1800 113h09m
shake-shake-26 2x128d, Cutout 16 2.58 1800 85h04m
shake-shake-26 2x128d, RICAP (beta=0.3) 1.97 1800 85h06m

Note

  • Results reported in the table are the test errors at last epochs.
  • All models are trained using cosine annealing with initial learning rate 0.2.
  • GeForce GTX 1080 Ti was used in these experiments, except ones with *, which are done using GeForce GTX 980.
bash
python train.py --config configs/cifar/wrn.yaml \
    train.batch_size 64 \
    train.output_dir experiments/wrn_28_10_cutout16 \
    scheduler.type cosine \
    augmentation.use_cutout True
bash
python train.py --config configs/cifar/shake_shake.yaml \
    model.shake_shake.initial_channels 64 \
    train.batch_size 64 \
    train.base_lr 0.1 \
    scheduler.epochs 300 \
    train.output_dir experiments/shake_shake_26_2x64d_SSI_cutout16/exp00 \
    augmentation.use_cutout True

Results using multi-GPU

Model batch size #GPUs Test Error (1 run) # of Epochs Training Time*
WRN-28-10, RICAP (beta=0.3) 512 1 2.63 200

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Pythoncifar10computer-visionfashion-mnistimagenet

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
CategoryDevOps
PricingOpen source

> Related tools

D
Docker
容器化平台,标准化应用交付
G
GitHub Actions
GitHub 原生 CI/CD 工作流
N
Nginx
高性能 Web 服务器与反向代理