Giter Site home page Giter Site logo

estherbear / implementation-of-pruning-filters Goto Github PK

View Code? Open in Web Editor NEW
27.0 3.0 2.0 338.37 MB

A reproduction of PRUNING FILTERS FOR EFFICIENT CONVNETS

Python 99.58% PowerShell 0.22% Batchfile 0.20%
prune pytorch imagenet cifar10 resnet vgg l1-norm

implementation-of-pruning-filters's Introduction

implementation-of-pruning-filters

A reproduction of PRUNING FILTERS FOR EFFICIENT CONVNETS

Arguments

  • -net: net type, default='resnet34'
  • -dataset: dataset, default='imagenet'
  • -b: batch size, default=256
  • -lr: initial learning rate, default=0.1
  • -e: epoch, default=90
  • -optim: optimizer, default="SGD"
  • -gpu: select GPU, default="0,1"
  • -retrainflag: retrain or not, default=False
  • -retrainepoch: retrain epoch, default=20
  • -retrainlr: retrain learning rate, default=0.001
  • -trainflag: train or not, default=False
  • -pruneflag: prune or not, default=False
  • -sortflag: sort filter by abs sum of weights or not, default=False
  • -independentflag: pruning strategy, default=False
  • -shortcutflag: prune the shortcut, default=True
  • -prune_channels: the number of channels to prune corresponding to the prune_layers
  • -prune_layers: the layers to prune

Examples

Tips: Please put your dataset in the data folder or modify your path to dataset in get_data.py before running the following code.

ResNet-34-pruned-B on ImageNet

python train.py -pruneflag -retrainflag -prune_layers conv_4 conv_6 conv_10 conv_12 conv_18 conv_20 conv_22 conv_24 -prune_channels 32 32 77 77 102 102 102 102

Analysis on pruning the the smallest filters in ResNet-34

python pruneAnalysis.py -pruneflag

Analysis on pruning the the smallest filters (shortcut) in ResNet-34

python pruneAnalysis.py -pruneflag -shortcutflag

Pretrain VGG-16 on cifar10

python train.py -net vgg16 -dataset cifar10 -b 128 -e 200

VGG-16-pruned-A on cifar10

python train.py -net vgg16 -dataset cifar10 -b 128 -pruneflag -prune_layers conv_1 conv_8 conv_9 conv_10 conv_11 conv_12 conv_13 -prune_channels 32 256 256 256 256 256 256 -retrainflag -retrainepoch 40 -retrainlr 0.001

Partial Results

model params FLOPs best_top1 best_top5 inference time(ms)
VGG-16 pretrained on CIFAR10 14.992M 314.562M 93.630% 99.670% 0.12387054112005236
ResNet-34 (pretrained model on pytorch) 21.798M 3.672G 73.314% 91.420% 0.753
VGG-16-pruned-A on CIFAR10 5.400M 207.102M 93.570% 99.550% 0.11985054855585098
ResNet-34-pruned-B on ImageNet 19.488M 2.793G 72.374% 90.974% 0.6542

VGG-16 ON CIFAR-10:

  • filters ranked by abs sum of weights:
    figure1
  • Prune the smallest filters:
    figure2
  • Prune the smallest filters and retrain: figure3

ResNet-34 ON ImageNet

  • Prune the smallest filters:
    figure4
  • Prune the smallest filters(shortcut):
    figure5

References

https://github.com/tyui592/Pruning_filters_for_efficient_convnets
https://arxiv.org/abs/1608.08710
https://arxiv.org/abs/1512.03385

implementation-of-pruning-filters's People

Contributors

estherbear avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

implementation-of-pruning-filters's Issues

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.