Coder Social home page Coder Social logo

wxb506 / sparse-winograd-cnn Goto Github PK

View Code? Open in Web Editor NEW

This project forked from xingyul/sparse-winograd-cnn

0.0 2.0 0.0 31 KB

Efficient Sparse-Winograd Convolutional Neural Networks

License: MIT License

Python 65.15% Shell 1.90% Makefile 2.10% C++ 30.85%

sparse-winograd-cnn's Introduction

Efficient Sparse-Winograd Convolutional Neural Networks

This is the code and models for paper Efficient Sparse-Winograd Convolutional Neural Networks by Xingyu Liu et al.

Introduction

This work is based on our ICLR 2018 paper. We propose modifications to Winograd-based CNN architecture to enable operation savings from Winograd’s minimal filtering algorithm and network pruning to be combined.

Convolutional Neural Networks (CNNs) are computationally intensive, which limits their application on mobile devices. Their energy is dominated by the number of multiplies needed to perform the convolutions. Winograd’s minimal filtering algorithm and network pruning can reduce the operation count, but these two methods cannot be straightforwardly combined — applying the Winograd transform fills in the sparsity in both the weights and the activations. We propose two modifications to Winograd-based CNNs to enable these methods to exploit sparsity.

In this repository, we release code and data for training Winograd-ReLU CNN on ImageNet as well as pre-trained and iteratively pruned Winograd-ReLU models.

Citation

If you find our work useful in your research, please consider citing:

@article{Liu2018Winograd,
  title={Efficient Sparse-Winograd Convolutional Neural Networks},
  author={Xingyu Liu and Jeff Pool and Song Han and William J. Dally},
  journal={International Conference on Learning Representations (ICLR)},
  year={2018}
}

Installation

Install TensorFlow and Tensorpack. The code has been tested with Python 2.7, TensorFlow 1.3.0, CUDA 8.0 and cuDNN 5.1 on Ubuntu 14.04.

Users may also need to download raw ImageNet dataset for ImageNet experiments. Users should ensure that the Tensorpack ResNet example can run with ImageNet.

Install customized Tensorflow Op:

cd /path/to/Sparse-Winograd-CNN/winograd2x2_cublas
make
export PYTHONPATH=/path/to/Sparse-Winograd-CNN/winograd2x2_cublas:$PYTHONPATH

Users may also change the -arch flag in winograd2x2_cublas/winograd2x2_imTrans/Makefile and winograd2x2_cublas/winograd2x2_conv/Makefile to suit their GPU computing capability.

Put ResNet-18-var/winograd_conv.py and ResNet-18-var/winograd_imtrans.py into the cloned tensorpack/models directory.

Usage

To train the Winograd-ReLU CNN from scratch on ImageNet with GPU 0 and 1:

./imagenet-resnet-transWino-prune.py --gpu 0,1 --data /path/to/dataset/imagenet

To use pre-trained model or test with pruned model, download the models. Then run with command:

./imagenet-resnet-transWino-prune.py --gpu 0,1 --data /path/to/dataset/imagenet --load /path/to/model-name.data-00000-of-00001

We also provided scripts for pruning, retraining and viewing the model: ResNet-18-var/prune_sh.sh, retrain_sh.sh and view_sh.sh.

License

Our code is released under MIT License (see LICENSE file for details).

sparse-winograd-cnn's People

Contributors

xingyul avatar

Watchers

James Cloos avatar wxb 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.