Home

Awesome

Pruning Filter in Filter

Introduction

This is the PyTorch implementation of our NeurIPS 2020 paper "Pruning Filter in Filter". In this paper:

  1. We propose a new pruning paradigm called Stripe-wise-Pruning(SP), which can be seen as a general case of the Filter-Pruning (FP). SP treats a filter $F \in \mathbb{R}^{C\times K\times K}$as $K\times K$ stripes (i.e., $1\times 1$ filters $\in \mathbb{R}^c $ ), and perform pruning at the unit of stripe instead of the whole filter. Compared to the existing methods, SP achieves finer granularity than traditional FP while being hardware friendly than Weight-Pruning and keeping independence between filters than Group-wise-Pruning, leading to state-of-the-art pruning ratio on CIFAR-10 and ImageNet.

  2. More arousingly, by applying SP, we find another important property of filters alongside their weight: shape. Start with a random initialized ResNet56, we train and trim the shape of filters and boost the test accuracy to 80.58% on CIFAR-10 without updating the filter weights. The optimal shape of filters are learned by the proposed Filter-Skeleton (FS) in the paper and we believe FS could inspire further research towards the essence of network pruning.

image

requirements

python3.7

pytorch1.4.0

torchvision0.5.0

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Figure in this paper‘s source file are available!!!

(If you find this paper/code/PPT are useful, please cite this paper + _ +)

We are working on accelerate deployment SWP by CUDA, please read CUDA-version branche's readme.md,

or 欢迎来知乎讨论 for more details.

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Baseline

mkdir -p checkpoint/VGG/baseline
python main.py --arch VGG --data_path ../data --save checkpoint/VGG/baseline
mkdir -p checkpoint/ResNet56/baseline
python main.py --arch ResNet56 --data_path ../data --save checkpoint/ResNet56/baseline

Training with Filter Skeleton & pruning Filter in Filter

mkdir -p checkpoint/VGG/sr0.00001_threshold_0.01
python main.py --arch VGG --data_path ../data --sr 0.00001 --threshold 0.01 --save checkpoint/VGG/sr0.00001_threshold_0.01
mkdir -p checkpoint/ResNet56/sr0.00001_threshold_0.01
python main.py --arch ResNet56 --data_path ../data --sr 0.00001 --threshold 0.01 --save checkpoint/ResNet56/sr0.00001_threshold_0.01

Results

BackboneMetricsParams(%) $\downarrow$FLOPS(%) $\downarrow$Accuracy(%)$\downarrow$
VGG16L16434.3-0.15
ThiNet63.9564.022.49
SSS73.841.60.23
SFP63.9563.911.17
GAL77.639.61.22
Hinge80.0539.07-0.34
HRank82.953.5-0.18
Ours92.6671.16-0.4
ResNet56L113.727.6-0.02
CP---501.00
NISP42.643.60.03
DCP70.347.1-0.01
IR---67.70.4
C-SGD---60.8-0.23
GBN66.770.30.03
HRank68.174.12.38
Ours75.677.70.12
BackboneMetricsFLOPS(%) $\downarrow$Top-1(%) $\downarrow$Top-5(%)$\downarrow$
ResNet18LCCL35.573.432.14
SFP42.722.661.3
FPGM42.721.350.6
TAS43.470.61-0.11
DMCP42.810.56---
Ours($\alpha =5e-6$)50.48-0.23-0.22
Ours($\alpha =2e-5$)54.580.170.04

Citation

If you find this code useful, please cite the following paper:

@inproceedings{NEURIPS2020_ccb1d45f,
	author = {Meng, Fanxu and Cheng, Hao and Li, Ke and Luo, Huixiang and Guo, Xiaowei and Lu, Guangming and Sun, Xing},
	booktitle = {Advances in Neural Information Processing Systems},
	editor = {H. Larochelle and M. Ranzato and R. Hadsell and M. F. Balcan and H. Lin},
	pages = {17629--17640},
	publisher = {Curran Associates, Inc.},
	title = {Pruning Filter in Filter},
	url = {https://proceedings.neurips.cc/paper/2020/file/ccb1d45fb76f7c5a0bf619f979c6cf36-Paper.pdf},
	volume = {33},
	year = {2020}
}

References

For CIFAR, our code is based on https://github.com/Eric-mingjie/rethinking-network-pruning

For ImageNet, our code is based on https://github.com/pytorch/examples/tree/master/imagenet