From 4b46fd6dc75d26b5604fdec75f6cc49e1d96d2a7 Mon Sep 17 00:00:00 2001 From: Lei Yang Date: Wed, 26 Aug 2020 16:34:15 +0800 Subject: [PATCH] Add CIFAR10 configs and models (#38) * rename cifar configs * add cifar10 configs * fix linting * add params, flops and accuracy in docs * add cifar10 pretrained models and logs * use oss-accelerate url * del unused cifar10 configs --- .../datasets/{cifar10.py => cifar10_bs16.py} | 2 +- configs/_base_/models/resnet101_cifar.py | 16 ++++++++++++++++ configs/_base_/models/resnet152_cifar.py | 16 ++++++++++++++++ configs/_base_/models/resnet34_cifar.py | 16 ++++++++++++++++ .../{cifar10.py => cifar10_bs128.py} | 0 configs/cifar10/resnet101_b16x8.py | 5 +++++ configs/cifar10/resnet152_b16x8.py | 5 +++++ configs/cifar10/resnet18.py | 4 ---- configs/cifar10/resnet18_b16x8.py | 4 ++++ configs/cifar10/resnet34_b16x8.py | 4 ++++ configs/cifar10/resnet50.py | 4 ---- configs/cifar10/resnet50_b16x8.py | 4 ++++ docs/model_zoo.md | 19 +++++++++++++++---- 13 files changed, 86 insertions(+), 13 deletions(-) rename configs/_base_/datasets/{cifar10.py => cifar10_bs16.py} (97%) create mode 100644 configs/_base_/models/resnet101_cifar.py create mode 100644 configs/_base_/models/resnet152_cifar.py create mode 100644 configs/_base_/models/resnet34_cifar.py rename configs/_base_/schedules/{cifar10.py => cifar10_bs128.py} (100%) create mode 100644 configs/cifar10/resnet101_b16x8.py create mode 100644 configs/cifar10/resnet152_b16x8.py delete mode 100644 configs/cifar10/resnet18.py create mode 100644 configs/cifar10/resnet18_b16x8.py create mode 100644 configs/cifar10/resnet34_b16x8.py delete mode 100644 configs/cifar10/resnet50.py create mode 100644 configs/cifar10/resnet50_b16x8.py diff --git a/configs/_base_/datasets/cifar10.py b/configs/_base_/datasets/cifar10_bs16.py similarity index 97% rename from configs/_base_/datasets/cifar10.py rename to configs/_base_/datasets/cifar10_bs16.py index 270b6d58f74..5e2a154f03f 100644 --- a/configs/_base_/datasets/cifar10.py +++ b/configs/_base_/datasets/cifar10_bs16.py @@ -19,7 +19,7 @@ dict(type='Collect', keys=['img', 'gt_label']) ] data = dict( - samples_per_gpu=128, + samples_per_gpu=16, workers_per_gpu=2, train=dict( type=dataset_type, data_prefix='data/cifar10', diff --git a/configs/_base_/models/resnet101_cifar.py b/configs/_base_/models/resnet101_cifar.py new file mode 100644 index 00000000000..a84d470e3a9 --- /dev/null +++ b/configs/_base_/models/resnet101_cifar.py @@ -0,0 +1,16 @@ +# model settings +model = dict( + type='ImageClassifier', + backbone=dict( + type='ResNet_CIFAR', + depth=101, + num_stages=4, + out_indices=(3, ), + style='pytorch'), + neck=dict(type='GlobalAveragePooling'), + head=dict( + type='LinearClsHead', + num_classes=10, + in_channels=2048, + loss=dict(type='CrossEntropyLoss', loss_weight=1.0), + )) diff --git a/configs/_base_/models/resnet152_cifar.py b/configs/_base_/models/resnet152_cifar.py new file mode 100644 index 00000000000..55c0cc6c66d --- /dev/null +++ b/configs/_base_/models/resnet152_cifar.py @@ -0,0 +1,16 @@ +# model settings +model = dict( + type='ImageClassifier', + backbone=dict( + type='ResNet_CIFAR', + depth=152, + num_stages=4, + out_indices=(3, ), + style='pytorch'), + neck=dict(type='GlobalAveragePooling'), + head=dict( + type='LinearClsHead', + num_classes=10, + in_channels=2048, + loss=dict(type='CrossEntropyLoss', loss_weight=1.0), + )) diff --git a/configs/_base_/models/resnet34_cifar.py b/configs/_base_/models/resnet34_cifar.py new file mode 100644 index 00000000000..55d033bc30b --- /dev/null +++ b/configs/_base_/models/resnet34_cifar.py @@ -0,0 +1,16 @@ +# model settings +model = dict( + type='ImageClassifier', + backbone=dict( + type='ResNet_CIFAR', + depth=34, + num_stages=4, + out_indices=(3, ), + style='pytorch'), + neck=dict(type='GlobalAveragePooling'), + head=dict( + type='LinearClsHead', + num_classes=10, + in_channels=512, + loss=dict(type='CrossEntropyLoss', loss_weight=1.0), + )) diff --git a/configs/_base_/schedules/cifar10.py b/configs/_base_/schedules/cifar10_bs128.py similarity index 100% rename from configs/_base_/schedules/cifar10.py rename to configs/_base_/schedules/cifar10_bs128.py diff --git a/configs/cifar10/resnet101_b16x8.py b/configs/cifar10/resnet101_b16x8.py new file mode 100644 index 00000000000..166a1740b09 --- /dev/null +++ b/configs/cifar10/resnet101_b16x8.py @@ -0,0 +1,5 @@ +_base_ = [ + '../_base_/models/resnet101_cifar.py', + '../_base_/datasets/cifar10_bs16.py', + '../_base_/schedules/cifar10_bs128.py', '../_base_/default_runtime.py' +] diff --git a/configs/cifar10/resnet152_b16x8.py b/configs/cifar10/resnet152_b16x8.py new file mode 100644 index 00000000000..3f307b6aa81 --- /dev/null +++ b/configs/cifar10/resnet152_b16x8.py @@ -0,0 +1,5 @@ +_base_ = [ + '../_base_/models/resnet152_cifar.py', + '../_base_/datasets/cifar10_bs16.py', + '../_base_/schedules/cifar10_bs128.py', '../_base_/default_runtime.py' +] diff --git a/configs/cifar10/resnet18.py b/configs/cifar10/resnet18.py deleted file mode 100644 index c23da96ae33..00000000000 --- a/configs/cifar10/resnet18.py +++ /dev/null @@ -1,4 +0,0 @@ -_base_ = [ - '../_base_/models/resnet18_cifar.py', '../_base_/datasets/cifar10.py', - '../_base_/schedules/cifar10.py', '../_base_/default_runtime.py' -] diff --git a/configs/cifar10/resnet18_b16x8.py b/configs/cifar10/resnet18_b16x8.py new file mode 100644 index 00000000000..c7afa397b7b --- /dev/null +++ b/configs/cifar10/resnet18_b16x8.py @@ -0,0 +1,4 @@ +_base_ = [ + '../_base_/models/resnet18_cifar.py', '../_base_/datasets/cifar10_bs16.py', + '../_base_/schedules/cifar10_bs128.py', '../_base_/default_runtime.py' +] diff --git a/configs/cifar10/resnet34_b16x8.py b/configs/cifar10/resnet34_b16x8.py new file mode 100644 index 00000000000..7f5cd517d50 --- /dev/null +++ b/configs/cifar10/resnet34_b16x8.py @@ -0,0 +1,4 @@ +_base_ = [ + '../_base_/models/resnet34_cifar.py', '../_base_/datasets/cifar10_bs16.py', + '../_base_/schedules/cifar10_bs128.py', '../_base_/default_runtime.py' +] diff --git a/configs/cifar10/resnet50.py b/configs/cifar10/resnet50.py deleted file mode 100644 index 615e2b5694a..00000000000 --- a/configs/cifar10/resnet50.py +++ /dev/null @@ -1,4 +0,0 @@ -_base_ = [ - '../_base_/models/resnet50_cifar.py', '../_base_/datasets/cifar10.py', - '../_base_/schedules/cifar10.py', '../_base_/default_runtime.py' -] diff --git a/configs/cifar10/resnet50_b16x8.py b/configs/cifar10/resnet50_b16x8.py new file mode 100644 index 00000000000..669e5de27e5 --- /dev/null +++ b/configs/cifar10/resnet50_b16x8.py @@ -0,0 +1,4 @@ +_base_ = [ + '../_base_/models/resnet50_cifar.py', '../_base_/datasets/cifar10_bs16.py', + '../_base_/schedules/cifar10_bs128.py', '../_base_/default_runtime.py' +] diff --git a/docs/model_zoo.md b/docs/model_zoo.md index 7b4a525bb78..293e35f756a 100644 --- a/docs/model_zoo.md +++ b/docs/model_zoo.md @@ -20,10 +20,21 @@ The ResNet family models below are trained by standard data augmentations, i.e., | ResNeXt-32x4d-101 | 44.18 | 8.03 | 78.7 | 94.34 | [model](https://openmmlab.oss-accelerate.aliyuncs.com/mmclassification/v0/imagenet/resnext101_32x4d_batch256_20200708-87f2d1c9.pth) | [log](https://openmmlab.oss-accelerate.aliyuncs.com/mmclassification/v0/imagenet/resnext101_32x4d_batch256_20200708-87f2d1c9.log.json) | | ResNeXt-32x8d-101 | 88.79 | 16.5 | 79.22 | 94.52 | [model](https://openmmlab.oss-accelerate.aliyuncs.com/mmclassification/v0/imagenet/resnext101_32x8d_batch256_20200708-1ec34aa7.pth) | [log](https://openmmlab.oss-accelerate.aliyuncs.com/mmclassification/v0/imagenet/resnext101_32x8d_batch256_20200708-1ec34aa7.log.json) | | ResNeXt-32x4d-152 | 59.95 | 11.8 | 79.06 | 94.47 | [model](https://openmmlab.oss-accelerate.aliyuncs.com/mmclassification/v0/imagenet/resnext152_32x4d_batch256_20200708-aab5034c.pth) | [log](https://openmmlab.oss-accelerate.aliyuncs.com/mmclassification/v0/imagenet/resnext152_32x4d_batch256_20200708-aab5034c.log.json) | -| SE-ResNet-50 | 28.09 | 4.13 | 77.74 | 93.84 | [model](https://openmmlab.oss-cn-hangzhou.aliyuncs.com/mmclassification/v0/imagenet/se-resnet50_batch256_20200804-ae206104.pth) | [log](https://openmmlab.oss-accelerate.aliyuncs.com/mmclassification/v0/imagenet/se-resnet50_batch256_20200708-657b3c36.log.json) | -| SE-ResNet-101 | 49.33 | 7.86 | 78.26 | 94.07 | [model](https://openmmlab.oss-cn-hangzhou.aliyuncs.com/mmclassification/v0/imagenet/se-resnet101_batch256_20200804-ba5b51d4.pth) | [log](https://openmmlab.oss-accelerate.aliyuncs.com/mmclassification/v0/imagenet/se-resnet101_batch256_20200708-038a4d04.log.json) | -| ShuffleNetV1 1.0x (group=3) | 1.87 | 0.146 | 68.13 | 87.81 | [model](https://openmmlab.oss-cn-hangzhou.aliyuncs.com/mmclassification/v0/imagenet/shufflenet_v1_batch1024_20200804-5d6cec73.pth) | [log](https://openmmlab.oss-cn-hangzhou.aliyuncs.com/mmclassification/v0/imagenet/shufflenet_v1_batch1024_20200804-5d6cec73.log.json) | -| ShuffleNetV2 1.0x | 2.28 | 0.149 | 69.55 | 88.92 | [model](https://openmmlab.oss-cn-hangzhou.aliyuncs.com/mmclassification/v0/imagenet/shufflenet_v2_batch1024_20200812-5bf4721e.pth) | [log](https://openmmlab.oss-cn-hangzhou.aliyuncs.com/mmclassification/v0/imagenet/shufflenet_v2_batch1024_20200804-8860eec9.log.json) | +| SE-ResNet-50 | 28.09 | 4.13 | 77.74 | 93.84 | [model](https://openmmlab.oss-accelerate.aliyuncs.com/mmclassification/v0/imagenet/se-resnet50_batch256_20200804-ae206104.pth) | [log](https://openmmlab.oss-accelerate.aliyuncs.com/mmclassification/v0/imagenet/se-resnet50_batch256_20200708-657b3c36.log.json) | +| SE-ResNet-101 | 49.33 | 7.86 | 78.26 | 94.07 | [model](https://openmmlab.oss-accelerate.aliyuncs.com/mmclassification/v0/imagenet/se-resnet101_batch256_20200804-ba5b51d4.pth) | [log](https://openmmlab.oss-accelerate.aliyuncs.com/mmclassification/v0/imagenet/se-resnet101_batch256_20200708-038a4d04.log.json) | +| ShuffleNetV1 1.0x (group=3) | 1.87 | 0.146 | 68.13 | 87.81 | [model](https://openmmlab.oss-accelerate.aliyuncs.com/mmclassification/v0/imagenet/shufflenet_v1_batch1024_20200804-5d6cec73.pth) | [log](https://openmmlab.oss-accelerate.aliyuncs.com/mmclassification/v0/imagenet/shufflenet_v1_batch1024_20200804-5d6cec73.log.json) | +| ShuffleNetV2 1.0x | 2.28 | 0.149 | 69.55 | 88.92 | [model](https://openmmlab.oss-accelerate.aliyuncs.com/mmclassification/v0/imagenet/shufflenet_v2_batch1024_20200812-5bf4721e.pth) | [log](https://openmmlab.oss-accelerate.aliyuncs.com/mmclassification/v0/imagenet/shufflenet_v2_batch1024_20200804-8860eec9.log.json) | | MobileNet V2 | 3.5 | 0.319 | 71.86 | 90.42 | [model](https://openmmlab.oss-accelerate.aliyuncs.com/mmclassification/v0/imagenet/mobilenet_v2_batch256_20200708-3b2dc3af.pth) | [log](https://openmmlab.oss-accelerate.aliyuncs.com/mmclassification/v0/imagenet/mobilenet_v2_batch256_20200708-3b2dc3af.log.json) | Models with * are converted from other repos, others are trained by ourselves. + + +## CIFAR10 + +| Model | Params(M) | Flops(G) | Top-1 (%) | Download | +|:---------------------:|:---------:|:--------:|:---------:|:--------:| +| ResNet-18-b16x8 | 11.17 | 0.56 | 94.72 | [model](https://openmmlab.oss-accelerate.aliyuncs.com/mmclassification/v0/cifar10/resnet18_b16x8_20200823-f906fa4e.pth) | [log](https://openmmlab.oss-accelerate.aliyuncs.com/mmclassification/v0/cifar10/resnet18_b16x8_20200823-f906fa4e.log.json) | +| ResNet-34-b16x8 | 21.28 | 1.16 | 95.34 | [model](https://openmmlab.oss-accelerate.aliyuncs.com/mmclassification/v0/cifar10/resnet34_b16x8_20200823-52d5d832.pth) | [log](https://openmmlab.oss-accelerate.aliyuncs.com/mmclassification/v0/cifar10/resnet34_b16x8_20200823-52d5d832.log.json) | +| ResNet-50-b16x8 | 23.52 | 1.31 | 95.36 | [model](https://openmmlab.oss-accelerate.aliyuncs.com/mmclassification/v0/cifar10/resnet50_b16x8_20200823-882aa7b1.pth) | [log](https://openmmlab.oss-accelerate.aliyuncs.com/mmclassification/v0/cifar10/resnet50_b16x8_20200823-882aa7b1.log.json) | +| ResNet-101-b16x8 | 42.51 | 2.52 | 95.66 | [model](https://openmmlab.oss-accelerate.aliyuncs.com/mmclassification/v0/cifar10/resnet101_b16x8_20200823-d9501bbc.pth) | [log](https://openmmlab.oss-accelerate.aliyuncs.com/mmclassification/v0/cifar10/resnet101_b16x8_20200823-d9501bbc.log.json) | +| ResNet-152-b16x8 | 58.16 | 3.74 | 95.96 | [model](https://openmmlab.oss-accelerate.aliyuncs.com/mmclassification/v0/cifar10/resnet152_b16x8_20200823-ad4d5d0c.pth) | [log](https://openmmlab.oss-accelerate.aliyuncs.com/mmclassification/v0/cifar10/resnet152_b16x8_20200823-ad4d5d0c.log.json) |