Code Monkey home page Code Monkey logo

kd's Introduction

Teacher-free-Knowledge-Distillation

1. Preparations

Clone this repository:

git clone https://github.com/yuanli2333/Teacher-free-Knowledge-Distillation.git

1.1 Environment

Build a new environment and install:

pip install -r requirements.txt

1.2 Dataset

CIFAR100, CIFAR10 and Tiny_ImageNet; For CIFAR100 and CIFAR10, our codes will download the datasets automatically. For Tiny-ImageNet, you should download and put in the dir: "data/". The follow instruction and commands are for CIFAR100.

2. Train baseline models

You can skip this step by using our pre-trained models in here. Download and unzip to: experiments/pretrained_teacher_models/

Use ''--model_dir'' to specify the directory of "parameters", model saving and log saving.

For example, normally train ResNet18 to obtain the pre-trained teacher:

CUDA_VISIBLE_DEVICES=0 python main.py --model_dir experiments/base_experiments/base_resnet18/

We ignore the command ''CUDA_VISIBLE_DEVICES=gpu_id'' in the following commands

Normally train MobileNetV2 to obtain the baseline model and baseline accuracy:

python main.py --model_dir experiments/base_experiments/base_mobilenetv2/

Normally train ResNeXt29 to obtain the baseline model and baseline accuracy:

python main.py --model_dir experiments/base_experiments/base_resnext29/

The baseline accuracy (in %) on CIFAR100 is:

Model Baseline Acc
MobileNetV2 68.38
ShuffleNetV2 70.34
ResNet18 75.87
ResNet50 78.16
GoogLeNet 78.72
Desenet121 79.04
ResNeXt29 81.03

3. Exploratory experiments (Section 2 in our paper)

Normal KD: ResNet18 teach MobileNetV2

python main.py --model_dir experiments/kd_experiments/mobilenet_distill/resnet18_teacher/

Reference

If you find this repo useful, please consider citing:

@inproceedings{yuan2020revisiting,
  title={Revisiting Knowledge Distillation via Label Smoothing Regularization},
  author={Yuan, Li and Tay, Francis EH and Li, Guilin and Wang, Tao and Feng, Jiashi},
  booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  pages={3903--3911},
  year={2020}
}

kd's People

Contributors

yuanli2333 avatar karthick47v2 avatar dependabot[bot] 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.