Home

Awesome

Caffe Implementation of ThiNet

Requirements

Python 2.6 & Caffe environment:

Usage

  1. Clone the ThiNet repository.
  2. select ThiNet_ICCV or ThiNet_TPAMI subfolder:
    cd ThiNet_ICCV
    
  3. modify your configuration path:
    • modify the caffe path (caffe_root) at the beginning of net_generator.py and compress_model.py
    • modify ImageNet lmdb file path in line 212 and line 217 of net_generator.py
    • modify ImageNet dataset path in line 54, 55, 60 of compress_model.py
    • modify line 2 and 4 in run_this.sh with correct file path.
  4. Run the pruning demo:
    ./run_this.sh
    

Other Toolkits

Results

We prune the VGG_ILSVRC_16_layers model on ImageNet dataset with ratio=0.5:

MethodTop-1 Acc.Top-5 Acc.#Param.#FLOPs
original VGG1671.50%90.01%138.24M30.94B
ThiNet_ICCV69.80%89.53%131.44M9.58B
ThiNet_TPAMI69.74%89.41%131.44M9.58B

There are no difference on VGG16, but ThiNet_TPAMI is much better on ResNet50:

MethodTop-1 Acc.Top-5 Acc.#Param.#FLOPs
original ResNet5075.30%92.20%25.56M7.72B
ThiNet_ICCV72.04%90.67%16.94M4.88B
ThiNet_TPAMI74.03%92.11%16.94M4.88B

Citation

If you find this work is useful for your research, please cite:

@CONFERENCE{ThiNet_ICCV17,
  author={Jian-Hao Luo, Jianxin Wu, and Weiyao Lin},
  title={ThiNet: A Filter Level Pruning Method for Deep Neural Network Compression},
  booktitle={ICCV},
  year = {2017},
  pages={5058-5066},
}
@article{ThiNet_TPAMI,
  author = {Jian-Hao Luo, Hao Zhang, Hong-Yu Zhou, Chen-Wei Xie, Jianxin Wu, and Weiyao Lin},
  title = {ThiNet: Pruning CNN Filters for a Thinner Net},
  journal = {IEEE Trans. on Pattern Analysis and Machine Intelligence},
  year = {2008},
}

Contact

Feel free to contact me if you have any question (Jian-Hao Luo luojh@lamda.nju.edu.cn or jianhao920@gmail.com).