Giter Club home page Giter Club logo

metapruning's Introduction

MetaPruning

This is the pytorch implementation of our paper "MetaPruning: Meta Learning for Automatic Neural Network Channel Pruning", https://arxiv.org/abs/1903.10258, published in ICCV 2019.

Traditional pruning decides pruning which channel in each layer and pays human effort in setting the pruning ratio of each layer. MetaPruning can automatically search for the best pruning ratio of each layer (i.e., number of channels in each layer).

MetaPruning contains two steps:

  1. train a meta-net (PruningNet), to provide reliable weights for all the possible combinations of channel numbers in each layer (Pruned Net structures).
  2. search for the best Pruned Net by evolutional algorithm and evaluate one best Pruned Net via training it from scratch.

Citation

If you use the code in your research, please cite:

@article{liu2019metapruning,
  title={MetaPruning: Meta Learning for Automatic Neural Network Channel Pruning},
  author={Liu, Zechun and Mu, Haoyuan and Zhang, Xiangyu and Guo, Zichao and Yang, Xin and Cheng, Tim Kwang-Ting and Sun, Jian},
  journal={arXiv preprint arXiv:1903.10258},
  year={2019}
}

Run

  1. Requirements:

    • python3, pytorch 1.1.0, torchvision 0.3.0
  2. ImageNet data:

    • You need to split the original training images into sub-validation dataset, which contains 50000 images randomly selected from the training images with 50 images in each 1000-class, and sub-training dataset with the rest of images. Training the PruningNet with the sub-training dataset and searching the pruned network with the sub-validation dataset for inferring model accuracy.
  3. Steps to run:

    • Step1: training

    • Step2: searching

    • Step3: evaluating

    • After training the Pruning Net, checkpioint.pth.tar will be generated in the training folder, which will be loaded by the searching algorithm. After searching is done, the top1 encoding vector will be shown in the log. By simply copying the encoding vector to the rngs = [ ] in evaluate.py, you can evaluate the Pruned Network corresponding to this encoding vector.

Models

MobileNet v1

Uniform Baselines Meta Pruning
Ratio Top1-Acc FLOPs Top1-Acc FLOPs Model
1x 70.6% 569M - - -
0.75x 68.4% 325M 70.9% 316M Model-MetaP-Mbv1-0.75
0.5x 63.7% 149M 66.1% 142M Model-MetaP-Mbv1-0.5
0.25x 50.6% 41M 57.2% 41M Model-MetaP-Mbv1-0.25

MobileNet v2

Uniform Baselines Meta Pruning
Top1-Acc FLOPs Top1-Acc FLOPs Model
74.7% 585M - - -
72.0% 313M 72.7% 303M Model-MetaP-Mbv2-300M
67.2% 140M 68.2% 140M Model-MetaP-Mbv2-140M
54.6% 43M 58.3% 43M Model-MetaP-Mbv2-40M

ResNet

Uniform Baselines Meta Pruning
Ratio Top1-Acc FLOPs Top1-Acc FLOPs Model
1x 76.6% 4.1G - - -
0.75x 74.8% 2.3G 75.4% 2.0G Model-MetaP-ResN-0.75
0.5x 72.0% 1.1G 73.4% 1.0G Model-MetaP-ResN-0.5

metapruning's People

Contributors

liuzechun avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.