Awesome
Discrimination-aware Channel Pruning for Deep Neural Networks (NeurIPS 2018)
Architecture of Discrimination-aware Channel Pruning (DCP)
Training Algorithm
<img height="300" src="./imgs/algorithm_1.png"/> <img height="300" src="./imgs/algorithm_2.png"/>Recent Update
2019.05.10
: We release a new version of dcp.
2018.11.27
: We release the source code of dcp.
Requirements
- python 2.7
- pytorch 0.4
- tensorflow
- pyhocon
- prettytable
Testing
-
Download the pre-trained pruned model from the model zoo.
-
Add DCP into PYTHONPATH.
# This is my path of DCP. You need to change to your path of DCP.
export PYTHONPATH=/home/liujing/Codes/Discrimination-aware-Channel-Pruning-for-Deep-Neural-Networks:$PYTHONPATH
- Set configuration for testing.
You need to set
save_path
,data_path
,dataset
,pruning_rate
,net_type
,depth
and thepretrained
indcp/test/test.hocon
.
cd dcp/test/
vim test.hocon
- Run testing.
python main.py test.hocon
Channel Pruning Examples
- Download pre-trained mdoel.
- Add DCP into PYTHONPATH.
# This is my path of DCP. You need to change to your path of DCP.
export PYTHONPATH=/home/liujing/Codes/Discrimination-aware-Channel-Pruning-for-Deep-Neural-Networks:$PYTHONPATH
- Before channel pruning, you need to add discrimination-aware loss and fine tune the whole network. You need to set
save_path
,data_path
,experiment_id
and thepretrained
indcp/auxnet/cifar10_resnet.hocon
.
cd dcp/auxnet/
vim cifar10_resnet.hocon
- Add discrimination-aware loss and conduct fine-tuning.
python main.py cifar10_resnet.hocon
- Set configuration for channel selection. You need to set
save_path
,data_path
,pruning_rate
andexperiment_id
indcp/channel_selection/cifar10_resnet.hocon
. Additionally, you need to setpretrained
to the path ofbest_model_with_aux_fc.pth
incheck_point
folder.
cd dcp/channel_selection/
vim cifar10_resnet.hocon
- Conduct channel selection.
python main.py cifar10_resnet.hocon
- Set configuration for fine-tuning. You need to set
save_path
,data_path
, andexperiment_id
indcp/finetune/cifar10_resnet.hocon
. Additionally, you need to setpretrained
to the path ofmodel_xxx_cs_000.pth
incheck_point
folder.
cd dcp/finetune/
vim cifar10_resnet.hocon
- Fine-tune the pruned model.
python main cifar10_resnet.hocon
Citation
If you find DCP useful in your research, please consider to cite the following related papers:
@incollection{NIPS2018_7367,
title = {Discrimination-aware Channel Pruning for Deep Neural Networks},
author = {Zhuang, Zhuangwei and Tan, Mingkui and Zhuang, Bohan and Liu, Jing and Guo, Yong and Wu, Qingyao and Huang, Junzhou and Zhu, Jinhui},
booktitle = {Advances in Neural Information Processing Systems 31},
editor = {S. Bengio and H. Wallach and H. Larochelle and K. Grauman and N. Cesa-Bianchi and R. Garnett},
pages = {881--892},
year = {2018},
publisher = {Curran Associates, Inc.},
url = {http://papers.nips.cc/paper/7367-discrimination-aware-channel-pruning-for-deep-neural-networks.pdf}
}