Coder Social home page Coder Social logo

pruing-framework's Introduction

A unified framework for various pruning methods. Fully object oriented, high extensibility.

Table of Contents

Requirements

  • Python 3.6
  • PyTorch 1.0.1 tested, 0.4.0 and above should also work.
  • TorchVision 0.2.2

Quick start

-source source.sh to activate the env. update env name to your existing or create it. -python run1.py

Architecture

Trainer

training related class and methods are defined in train3.py, inlcuding train(), validate(), try_resume().

Methodology

Pruning methods are defined in functions/, for example, mask.py is the method for norm and geo-median filter pruning.

Layer variants

Here new layers is derived from basic Pytorch layers such as Conv2D and Linear. Override the original forward and backward function as needed. In this way, there is no need to explicitly load and rewrite data using buffer at the top main().

Network

Networks are defined in models/, import desired layer variants before constructing the network.

Config and Args

Configurations are fined in config_.py with easydict, which can be updated by arguments. Args parser is in top main file: run1.py.

Added pruning methods

Here I added several popular pruning methods.

Norm based non-structural method

Norm-based filter pruning

Geomeric median-based filter pruning

Create a new pruning methods

Notes

Torchvision Version

We use the torchvision of 0.3.0. If the version of your torchvision is 0.2.0, then the transforms.RandomResizedCrop should be transforms.RandomSizedCrop and the transforms.Resize should be transforms.Scale.

Why use 100 epochs for training

This can improve the accuracy slightly.

Process of ImageNet dataset

We follow the Facebook process of ImageNet. Two subfolders ("train" and "val") are included in the "/path/to/ImageNet2012". The correspding code is here.

FLOPs Calculation

Refer to the file.

Citation

For Filter Pruning via Geometric Median: i1

@inproceedings{he2019filter,
  title     = {Filter Pruning via Geometric Median for Deep Convolutional Neural Networks Acceleration},
  author    = {He, Yang and Liu, Ping and Wang, Ziwei and Hu, Zhilan and Yang, Yi},
  booktitle = {Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
  year      = {2019}
}

pruing-framework's People

Contributors

zhl95 avatar

Watchers

 avatar  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.