Slimmable Networks
An open source framework for slimmable training on tasks of ImageNet classification and COCO detection, which has enabled numerous projects. 1, 2, 3
1. Slimmable Neural Networks ICLR 2019 Paper | OpenReview | Detection | Model Zoo
Illustration of slimmable neural networks. The same model can run at different widths (number of active channels), permitting instant and adaptive accuracy-efficiency trade-offs.
2. Universally Slimmable Networks and Improved Training Techniques ICCV 2019 Paper | Model Zoo
Illustration of universally slimmable networks. The same model can run at arbitrary widths.
3. AutoSlim: Towards One-Shot Architecture Search for Channel Numbers NeurIPS 2019 Workshop Paper | Model Zoo
AutoSlimming MobileNet v1, MobileNet v2, MNasNet and ResNet-50: the optimized number of channels under each computational budget (FLOPs).
Run
- Requirements:
- python3, pytorch 1.0, torchvision 0.2.1, pyyaml 3.13.
- Prepare ImageNet-1k data following pytorch example.
- Training and Testing:
- The codebase is a general ImageNet training framework using yaml config under
apps
dir, based on PyTorch. - To test, download pretrained models to
logs
dir and directly run command. - To train, comment
test_only
andpretrained
in config file. You will need to manage visible gpus by yourself. - Command:
python train.py app:{apps/***.yml}
.{apps/***.yml}
is config file. Do not missapp:
prefix. - Training and testing of MSCOCO benchmarks are released under branch detection.
- The codebase is a general ImageNet training framework using yaml config under
- Still have questions?
- If you still have questions, please search closed issues first. If the problem is not solved, please open a new.
Slimmable Model Zoo
Model | Switches (Widths) | Top-1 Err. | FLOPs | Model ID |
---|---|---|---|---|
S-MobileNet v1 | 1.00 0.75 0.50 0.25 |
28.5 30.5 35.2 46.9 |
569M 325M 150M 41M |
a6285db |
S-MobileNet v2 | 1.00 0.75 0.50 0.35 |
29.5 31.1 35.6 40.3 |
301M 209M 97M 59M |
0593ffd |
S-ShuffleNet | 2.00 1.00 0.50 |
28.6 34.5 42.8 |
524M 138M 38M |
1427f66 |
S-ResNet-50 | 1.00 0.75 0.50 0.25 |
24.0 25.1 27.9 35.0 |
4.1G 2.3G 1.1G 278M |
3fca9cc |
Universally Slimmable Networks and Improved Training Techniques
Model | Model ID | Spectrum | |||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
US‑MobileNet v1 | 13d5af2 | Width MFLOPs Top-1 Err. |
1.0 568Â 28.2Â |
0.975Â 543Â 28.3Â |
0.95Â 517Â 28.4Â |
0.925Â 490Â 28.7Â |
0.9Â 466Â 28.7Â |
0.875Â 443Â 29.1Â |
0.85Â 421Â 29.4Â |
0.825Â 389Â 29.7Â |
0.8Â 366Â 30.2Â |
0.775Â 345Â 30.3Â |
0.75Â 325Â 30.5Â |
0.725Â 306Â 30.9Â |
0.7Â 287Â 31.2Â |
0.675Â 267Â 31.7Â |
0.65Â 249Â 32.2Â |
0.625Â 232Â 32.5Â |
0.6Â 217Â 33.2Â |
0.575Â 201Â 33.7Â |
0.55Â 177Â 34.4Â |
0.525Â 162Â 35.0Â |
0.5Â 149Â 35.8Â |
0.475Â 136Â 36.5Â |
0.45Â 124Â 37.3Â |
0.425Â 114Â 38.1Â |
0.4Â 100Â 39.0Â |
0.375Â 89Â 40.0Â |
0.35Â 80Â 41.0Â |
0.325Â 71Â 41.9Â |
0.3Â 64Â 42.7Â |
0.275Â 48Â 44.2Â |
0.25 41 44.3 |
US‑MobileNet v2 | 3880cad | Width MFLOPs Top-1 Err. |
1.0Â 300Â 28.5Â |
0.975Â 299Â 28.5Â |
0.95Â 284Â 28.8Â |
0.925Â 274Â 28.9Â |
0.9Â 269Â 29.1Â |
0.875Â 268Â 29.1Â |
0.85Â 254Â 29.4Â |
0.825Â 235Â 29.9Â |
0.8Â 222Â 30.0Â |
0.775Â 213Â 30.2Â |
0.75Â 209Â 30.4Â |
0.725Â 185Â 30.7Â |
0.7Â 173Â 31.1Â |
0.675Â 165Â 31.4Â |
0.65Â 161Â 31.7Â |
0.625Â 161Â 31.7Â |
0.6Â 151Â 32.4Â |
0.575Â 150Â 32.4Â |
0.55Â 106Â 34.4Â |
0.525Â 100Â 34.6Â |
0.5Â 97Â 34.9Â |
0.475Â 96Â 35.1Â |
0.45Â 88Â 35.8Â |
0.425Â 88Â 35.8Â |
0.4Â 80Â 36.6Â |
0.375Â 80Â 36.7Â |
0.35 59 37.7Â |
AutoSlim: Towards One-Shot Architecture Search for Channel Numbers
Model | Top-1 Err. | FLOPs | Model ID |
---|---|---|---|
AutoSlim-MobileNet v1 | 27.0 28.5 32.1 |
572M 325M 150M |
9b0b1ab |
AutoSlim-MobileNet v2 | 24.6 25.8 27.0 |
505M 305M 207M |
a24f1f2 |
AutoSlim-MNasNet | 24.6 25.4 26.8 |
532M 315M 217M |
31477c9 |
AutoSlim-ResNet-50 | 24.0 24.4 26.0 27.8 |
3.0G 2.0G 1.0G 570M |
f95f419 |
Technical Details
Implementing slimmable networks and slimmable training is straightforward:
- Switchable batchnorm and slimmable layers are implemented in
models/slimmable_ops
. - Slimmable training is implemented in these lines in
train.py
.
License
CC 4.0 Attribution-NonCommercial International
The software is for educaitonal and academic research purpose only.