Skip to content

Hong-Ming/Adaptive-Network-Slimming

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Run Time Adaptive Network Slimming for Mobile Environments

Code for training resnet models referenced from: https://github.com/kuangliu/pytorch-cifar

Cite

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}
  }

Table of Contents

Intorduction

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).

Directory Tree

  • /:
    • 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.

Setup and Usage

Package Version

  • Python 3.6
  • PyTorch 1.10
  • Torchvision 0.3.0
  • CUDA 10.0

Hardware and Operation System

  • CPU: Intel i7-8700 3.2GHz
  • Graphics Cards: GeForce RTX 2080 Ti
  • OS: Ubuntu 18.04

Environment setup

  1. 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
  1. Activate conda environment
conda activate myenv

Usage

  1. Run network slimming model with uniform pruning rate. Use -net to select ResNet with different depth, available options are resnet18, resnet34 and resnet50.
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

Reference

[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.

Author

Name : Hong-Ming Chiu

Email : hmchiu2 [at] illinois.edu

Website : https://hong-ming.github.io

License

MIT License

About

Official code for "Run Time Adaptive Network Slimming for Mobile Environments", ISCAS 2019.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages