Giter Club home page Giter Club logo

multiexit-distillation's Introduction

Distillation-Based Training for Multi-Exit Architectures (Mary Phuong, Christoph H. Lampert, ICCV 2019)

We present a new method for training multi-exit architectures. A multi-exit architecture looks like this:

Multi-exit architecture

Early exits are classifier blocks attached to intermediate convolutional blocks. They are usually less accurate than the last exit, but faster to evaluate. Multi-exit architectures are useful for trading off accuracy for speed at test time, e.g. when the inference budget varies per example.

We propose to train such architectures by transferring knowledge from late exits () to early exits (, , ...), via so-called distillation, and show that (especially) early exits benefit substantially.

Read more in the paper. This repo provides code for that paper.

Setup

  1. Install the following (though other setups may work too):
  • python 3.6.3
  • torch 0.4.0
  • torchvision 0.2.1
  • pandas
  • sacred
  1. Create sub-directories data and snapshots in the repo root directory.

  2. Download torchvision.datasets.CIFAR100 into data. You can do this by running the following from the repo root directory:

python -c 'import torchvision; torchvision.datasets.CIFAR100("./data", download=True)'

Training

To train a multi-exit network by distillation-based training:

  1. Specify hyperparameters and other options by editing the script train_cifar.py. (Sensible default values are provided.)

  2. Run

python train_cifar.py

Evaluation

To evaluate a trained network on test data:

  1. Specify options by editing the script eval.py.

  2. Run

python eval.py

multiexit-distillation's People

Contributors

mary-phuong 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.