Code Monkey home page Code Monkey logo

meal's Introduction

MEAL: Multi-Model Ensemble via Adversarial Learning

CE9AAD0B-5819-4723-898E-846090EC8F51

This is the official PyTorch implementation for paper:

MEAL: Multi-Model Ensemble via Adversarial Learning (AAAI 2019, Oral).

Zhiqiang Shen*, Zhankui He*, Xiangyang Xue.

The key idea of this work is distilling diverse knowledge from different trained models (teachers) into a single student network, in order to learn an ensemble of multiple models without incurring additional testing costs. We use adversarial-based learning strategy where we define a block-wise training loss to guide and optimize the predefined student network to recover the knowledge in teacher models, and to promote the discriminator network to distinguish teacher vs. student features simultaneously.

The student and teacher networks we implemented are listed in \models, and it is also easy to add new networks in our repo. The corresponding author of this paper is: Dr. Zhiqiang Shen.

If you find this helps your research, please cite:

@inproceedings{shen2019MEAL,
	title = {MEAL: Multi-Model Ensemble via Adversarial Learning},
	author = {Shen, Zhiqiang and He, Zhankui and Xue, Xiangyang},
	booktitle = {AAAI},
	year = {2019}
}

Quick Start

  • git clone this repo
  • download pre-trained teachers (on CIFAR-10):
sh ./scripts/download_pretrained_models.sh

(You can also manually download them here.)

  • for single MEAL like teacher: vgg, student: vgg:
python main.py --gpu_id 0 --teachers [\'vgg19_BN\'] --student vgg19_BN --d_lr 1e-3 --fc_out 1 --pool_out avg --loss ce --adv 1 --out_layer [0,1,2,3,4] --out_dims [10000,5000,1000,500,10] --gamma [0.001,0.01,0.05,0.1,1] --eta [1,1,1,1,1] --name vgg_test
  • for ensemble MEAL like teachers: vgg19, densenet, dpn92,resnet18, preactresnet18; student:densenet:
python main.py --gpu_id 0 --lr 0.1 --batch_size 256 --teachers [\'vgg19_BN\',\'dpn92\',\'resnet18\',\'preactresnet18\',\'densenet_cifar\'] --student densenet_cifar --d_lr 1e-3 --fc_out 1 --pool_out avg --loss ce --adv 1 --gamma [1,1,1,1,1] --eta [1,1,1,1,1] --name 5_ensemble_for_densenet --out_layer [-1] 

Environment

Python 3.6+

PyTorch 0.40+

Numpy 1.12+

Learning rate adjustment

I manually change the lr during training:

  • 0.1 for epoch [0,a*150)
  • 0.01 for epoch [a*150,a*250)
  • 0.001 for epoch [a*250,a*350)

The factor a varies with number of teacher networks, between 1 and 2.

ImageNet model

Our trained ResNet-50 (the accuracy is even comparable to PyTorch official ResNet-152):

Models Top-1 error (%) Top-5 error (%) URL
ResNet-50 23.85 7.13 -
ResNet-101 22.63 6.44 -
ResNet-152 21.69 5.94 -
Our ResNet-50 21.79 5.99 Download (102.5M)

meal's People

Contributors

szq0214 avatar aaronheee avatar

Watchers

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