- python 2.7
- pytorch 0.4
- tensorflow
- pyhocon
- Download the pre-trained pruned model.
- resnet-18-pruned0.3 BaiduDrive, resnet-18-pruned0.3 GoogleDrive
- resnet-18-pruned0.5 BaiduDrive, resnet-18-pruned0.5 GoogleDrive
- resnet-18-pruned0.7 BaiduDrive, resnet-18-pruned0.7 GoogleDrive
- resnet-50-pruned0.3 BaiduDrive, resnet-50-pruned0.3 GoogleDrive
- resnet-50-pruned0.5 BaiduDrive, resnet-50-pruned0.5 GoogleDrive
- resnet-50-pruned0.7 BaiduDrive, resnet-50-pruned0.7 GoogleDrive
- 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
data_path
,pruning_rate
,depth
and theretrain
indcp/channel_pruning/test.hocon
.
cd dcp/channel_pruning/
vim dcp/channel_pruning/test.hocon
- Run testing.
python test.py test.hocon
- 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
- Set configuration for channel pruning.
Before pruning, you need to set
save_path
,data_path
,experiment_id
and theretrain
indcp/channel_pruning/cifar10_resnet.hocon
.
cd dcp/channel_pruning/
vim dcp/channel_pruning/cifar10_resnet.hocon
- Run Discrimination-aware Channel Pruning.
python channel_pruning.py cifar10_resnet.hocon
- Set configuration for fine-tuning.
Before fine-tuning, you need to set
retrain
to the path ofmodel_004.pth
incheck_point
folder
vim cifar10_resnet.hocon
- Fine-tune the pruned model.
python fine_tuning.py cifar10_resnet.hocon
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}
}