Coder Social home page Coder Social logo

multiwaybp's Introduction

Multi-way Backpropagation for Training Compact Deep Neural Networks

Training code for Multi-way BP. Both the Pytorch and Torch implementations are available.

PyTorch Implementation

Requirements

  • Pytorch=1.0.0
  • python=2.7

Train Method

  1. Prepare data

    Download the training data (e.g., CIFAR-10) and put them to your own directory.

  2. Train deep models with Multi-way BP

 cd multiwaybp-pytorch
 python main.py

You may refer to options.py for more argument.

Some Key arguments:

  • dataPath : path for loading data set
  • save_path : path for saving model file
  • nGPU : number of GPUs to use (support multi-gpu) (Default: 1)
  • netType : choose the network type as baseline model
  • pivotSet : where to add aux-classifier

Torch Implementation

Requirements

See the installation instructions for a step-by-step guide.

  • Install Torch on a machine with CUDA GPU
  • Install cuDNN and the corresponding bindings in Torch

If you already have Torch installed, update the luarocks nn, cunn and cudnn.

Training Method

  1. Prepare data

    Download the training data (e.g., CIFAR-10) and put them to your own directory.

  2. Train deep models with Multi-way BP

 cd multiwaybp-torch
 th train.lua

Testing Method

  1. Test pre-trained models

To test the performance of the MwResNet models, please download the pre-trained models and move them into the directory ./pretrained. Then you can run the script test.lua. For example:

th test.lua -dataset cifar10 -model cifar10-mwresnet-26-2-wide-10 
  1. Test intermediate models

During the training, Multi-way BP simultaneously generates multiple models with different depth. Take CIFAR10-MwResNet-56-5 (including the ''auxiliary outputs'' file) for example:

Intermediate models Depth #Params
model-15 15 0.03M
model-25 25 0.09M
model-35 35 0.18M
model-45 45 0.48M
model-56 56 0.85M

To test the intermediate models, simply run the script intermediate.lua.

th intermediate.lua -dataset cifar10 -model cifar10-mwresnet-56-5 -outputs cifar10-mwresnet-56-5-outputs

multiwaybp's People

Contributors

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