Authors: Hong-Ming Chiu, Kuan-Chih Lin, Tian Sheuan Chang
Code for training resnet models referenced from: https://github.com/kuangliu/pytorch-cifar
Please cite our paper if you use this code in your own work:
@inproceedings{chiu2019,
author={Hong-Ming Chiu and Kuan-Chih Lin and Tian Sheuan Chang,
booktitle={2019 IEEE International Symposium on Circuits and Systems (ISCAS)},
title={Run Time Adaptive Network Slimming for Mobile Environments},
year={2019},
pages={1-4},
doi={10.1109/ISCAS.2019.8701884}
}
This Python program contains the code for the paper "Run Time Adaptive Network Slimming for Mobile Environments" and the code for training the ResNet [2] model. This program performs the interface stage pruning and conculates the pruning rate based on the saving in floating point operations (FLOP).
/
:- Adapted_Network.py: main function for Adaptive Network Slimming. [1]
model_pkl/
:- <model name>.pkl: pretrained model file.
train_model/
- main.py: main function for training model.
result/
- resnet18_uniform.png: result of pruning ResNet18 with uniform pruning rate.
- resnet18_nonuniform.png: result of pruning ResNet18 with non-uniform pruning rate.
- Python 3.6
- PyTorch 1.10
- Torchvision 0.3.0
- CUDA 10.0
- CPU: Intel i7-8700 3.2GHz
- Graphics Cards: GeForce RTX 2080 Ti
- OS: Ubuntu 18.04
- Set up the environment using Anaconda
conda create -n myenv python=3.6
conda install --name myenv pytorch==1.1.0 torchvision==0.3.0 cudatoolkit=10.0 -c pytorch
- Activate conda environment
conda activate myenv
- Run network slimming model with uniform pruning rate.
Use
-net
to select ResNet with different depth, available options areresnet18
,resnet34
andresnet50
.
python3 Adapted_Network.py -net resnet18
Use --nonuniform
to run network slimming model with non-uniform pruning rate.
python3 Adapted_Network.py -net resnet18 --nonuniform
[1] Hong-Ming Chiu, Kuan-Chih Lin and Tian Sheuan Chang, "Run Time Adaptive Network Slimming for Mobile Environments," 2019 IEEE International Symposium on Circuits and Systems (ISCAS).
[2] Kaiming He and Xiangyu Zhang and Shaoqing Ren and Jian Sun, "Deep Residual Learning for Image Recognition," 2015.
Name : Hong-Ming Chiu
Email : hmchiu2 [at] illinois.edu
Website : https://hong-ming.github.io
MIT License