← Open Source
megvii-research

mdistiller

The official implementation of [CVPR2022] Decoupled Knowledge Distillation https://arxiv.org/abs/2203.08679 and [ICCV2023] DOT: A Distillation-Oriented Trainer https://openaccess.thecvf.com/content/ICCV2023/papers/Zhao_DOT_A_Distillation-Oriented_Trainer_ICCV_2023_paper.pdf.

Model DevelopmentTraining toolkitsPython
Open on GitHub
Momentum
+0stars in 24 hours0.0%
899
Stars
130
Forks
+2
This week
1
Contributors
Created 2022-03-16 · Updated 2026-10-14 · #12798 today
Top developers
Zzzzz1

megvii-research/mdistiller is ranked 12,798 with 899 stars.

Same-category comparison

megvii-research/mdistiller is ranked 12,798 among these 8 peers; bytedance/fedlearner is ranked 12,796.

Same-category comparison
NameRankMetrics
zhulf0804/PointPillars12,785
Language:
Python
Stars:
902
Forks:
194
Description:
A Simple PointPillars PyTorch Implementation for 3D LiDAR(KITTI) Detection.
microsoft/farmvibes-ai12,789
Language:
Jupyter Notebook
Stars:
901
Forks:
184
Description:
FarmVibes.AI: Multi-Modal GeoSpatial ML Models for Agriculture and Sustainability.
PRBonn/semantic-kitti-api12,795
Language:
Python
Stars:
899
Forks:
193
Description:
SemanticKITTI API for visualizing dataset, processing data, and evaluating results.
bytedance/fedlearner12,796
Language:
Python
Stars:
899
Forks:
174
Description:
A multi-party collaborative machine learning framework.
davheld/GOTURN12,803
Language:
C++
Stars:
898
Forks:
312
Description:
Source code for paper: Learning to Track at 100 FPS with Deep Regression Networks, Held, et al. ECCV 2016.
HuguesTHOMAS/KPConv-PyTorch12,809
Language:
Python
Stars:
897
Forks:
176
Description:
Kernel Point Convolution implemented in PyTorch.
txie-93/cgcnn12,828
Language:
Python
Stars:
896
Forks:
356
Description:
Crystal graph convolutional neural networks for predicting material properties.
Visual-Attention-Network/SegNeXt12,830
Language:
Python
Stars:
895
Forks:
91
Description:
Official Pytorch implementations for "SegNeXt: Rethinking Convolutional Attention Design for Semantic Segmentation" (NeurIPS 2022).
Key parameters and specifications
Key parameters and specifications
ParameterValue
LanguagePython
CategoryModel Development
SubcategoryTraining toolkits
Stars899
Forks130
Contributors1
Created date2022-03-16
Updated date2026-10-14
Stars in 1 day0
Stars in 7 days2
Rank12,798
Previous rank12,696
Rank change-102
7-day stars rank8,388
Previous 7-day stars rank8,464
7-day stars rank change76
Total stars rank12,097
Previous total stars rank12,074
Total stars rank change-23
CountryChina
README summary

This repo is (1) a PyTorch library that provides classical knowledge distillation algorithms on mainstream CV benchmarks, (2) the official implementation of the CVPR-2022 paper: Decoupled Knowledge Distillation. (3) the official implementation of the ICCV-2023 paper: DOT: A Distillation-Oriented Trainer. 0 Install the package: Getting started 0. Wandb as the logger The registeration: . If you don't want wandb as your logger, set as at . Evaluation You can evaluate the performance of our models or models trained by

yourself. Our models are at , please download the checkpoints to If test the models on ImageNet, please download the dataset at and put them to 2. Training on CIFAR-100 Download the at and untar it to via . Training on ImageNet Download the dataset at and put them to 4. Extension: Visualizations Jupyter notebooks: tsne and correlation_matrices Custom Distillation Method 1. create a python file at and define the distiller 2. regist the corresponding hyper-parameters at 4. Citation

If this repo is helpful for your research, please consider citing the paper: License MDistiller is released under the MIT license. Acknowledgement Thanks for CRD and ReviewKD. We build this library based on the CRD's codebase and the ReviewKD's codebase. Thanks Yiyu Qiu and Yi Shi for the code contribution during their internship in MEGVII Technology. Thanks Xin Jin for the discussion about DKD.

Frequently asked questions

How many stars and forks are recorded?

megvii-research/mdistiller has 899 stars and 130 forks.

What is the repository rank?

megvii-research/mdistiller is ranked 12,798.

What language and category are recorded?

megvii-research/mdistiller has 899 stars, uses Python and belongs to Model Development.

Which repository is closest in rank?

megvii-research/mdistiller is compared with bytedance/fedlearner, ranked 12,796 with 899 stars.

README

This repo is

(1) a PyTorch library that provides classical knowledge distillation algorithms on mainstream CV benchmarks,

(2) the official implementation of the CVPR-2022 paper: Decoupled Knowledge Distillation.

(3) the official implementation of the ICCV-2023 paper: DOT: A Distillation-Oriented Trainer.

DOT: A Distillation-Oriented Trainer

Framework

Main Benchmark Results

On CIFAR-100:

| Teacher
Student | ResNet32x4
ResNet8x4| VGG13
VGG8| ResNet32x4
ShuffleNet-V2| |:---------------:|:-----------------:|:-----------------:|:-----------------:| | KD | 73.33 | 72.98 | 74.45 | | KD+DOT | 75.12 | 73.77 | 75.55 |

On Tiny-ImageNet:

| Teacher
Student |ResNet18
MobileNet-V2|ResNet18
ShuffleNet-V2| |:---------------:|:-----------------:|:-----------------:| | KD | 58.35 | 62.26 | | KD+DOT | 64.01 | 65.75 |

On ImageNet:

| Teacher
Student |ResNet34
ResNet18|ResNet50
MobileNet-V1| |:---------------:|:-----------------:|:-----------------:| | KD | 71.03 | 70.50 | | KD+DOT | 71.72 | 73.09 |

Decoupled Knowledge Distillation

Framework & Performance

Main Benchmark Results

On CIFAR-100:

| Teacher
Student |ResNet56
ResNet20|ResNet110
ResNet32| ResNet32x4
ResNet8x4| WRN-40-2
WRN-16-2| WRN-40-2
WRN-40-1 | VGG13
VGG8| |:---------------:|:-----------------:|:-----------------:|:-----------------:|:------------------:|:------------------:|:--------------------:| | KD | 70.66 | 73.08 | 73.33 | 74.92 | 73.54 | 72.98 | | DKD | 71.97 | 74.11 | 76.32 | 76.23 | 74.81 | 74.68 |

| Teacher
Student |ResNet32x4
ShuffleNet-V1|WRN-40-2
ShuffleNet-V1| VGG13
MobileNet-V2| ResNet50
MobileNet-V2| ResNet32x4
MobileNet-V2| |:---------------:|:-----------------:|:-----------------:|:-----------------:|:------------------:|:------------------:| | KD | 74.07 | 74.83 | 67.37 | 67.35 | 74.45 | | DKD | 76.45 | 76.70 | 69.71 | 70.35 | 77.07 |

On ImageNet:

| Teacher
Student |ResNet34
ResNet18|ResNet50
MobileNet-V1| |:---------------:|:-----------------:|:-----------------:| | KD | 71.03 | 70.50 | | DKD | 71.70 | 72.05 |

MDistiller

Introduction

MDistiller supports the following distillation methods on CIFAR-100, ImageNet and MS-COCO:

Method Paper Link CIFAR-100 ImageNet MS-COCO
KD ✓ ✓
FitNet ✓
AT ✓ ✓
NST ✓
PKT ✓
KDSVD ✓
OFD ✓ ✓
RKD ✓
VID ✓
SP ✓
CRD ✓ ✓
ReviewKD ✓ ✓ ✓
DKD ✓ ✓ ✓

Installation

Environments:

  • Python 3.6
  • PyTorch 1.9.0
  • torchvision 0.10.0

Install the package:

sudo pip3 install -r requirements.txt
sudo python3 setup.py develop

Getting started

  1. Wandb as the logger
  • The registeration: .
  • If you don't want wandb as your logger, set CFG.LOG.WANDB as False at mdistiller/engine/cfg.py.
  1. Evaluation
  • You can evaluate the performance of our models or models trained by yourself.

  • Our models are at , please download the checkpoints to ./download_ckpts

  • If test the models on ImageNet, please download the dataset at and put them to ./data/imagenet

    # evaluate teachers
    python3 tools/eval.py -m resnet32x4 # resnet32x4 on cifar100
    python3 tools/eval.py -m ResNet34 -d imagenet # ResNet34 on imagenet
    
    # evaluate students
    python3 tools/eval.p -m resnet8x4 -c download_ckpts/dkd_resnet8x4 # dkd-resnet8x4 on cifar100
    python3 tools/eval.p -m MobileNetV1 -c download_ckpts/imgnet_dkd_mv1 -d imagenet # dkd-mv1 on imagenet
    python3 tools/eval.p -m model_name -c output/your_exp/student_best # your checkpoints
    
  1. Training on CIFAR-100
  • Download the cifar_teachers.tar at and untar it to ./download_ckpts via tar xvf cifar_teachers.tar.

    # for instance, our DKD method.
    python3 tools/train.py --cfg configs/cifar100/dkd/res32x4_res8x4.yaml
    
    # you can also change settings at command line
    python3 tools/train.py --cfg configs/cifar100/dkd/res32x4_res8x4.yaml SOLVER.BATCH_SIZE 128 SOLVER.LR 0.1
    
  1. Training on ImageNet
  • Download the dataset at and put them to ./data/imagenet

    # for instance, our DKD method.
    python3 tools/train.py --cfg configs/imagenet/r34_r18/dkd.yaml
    
  1. Training on MS-COCO
  1. Extension: Visualizations

Custom Distillation Method

  1. create a python file at mdistiller/distillers/ and define the distiller
from ._base import Distiller

class MyDistiller(Distiller):
    def __init__(self, student, teacher, cfg):
        super(MyDistiller, self).__init__(student, teacher)
        self.hyper1 = cfg.MyDistiller.hyper1
        ...

    def forward_train(self, image, target, **kwargs):
        # return the output logits and a Dict of losses
        ...
    # rewrite the get_learnable_parameters function if there are more nn modules for distillation.
    # rewrite the get_extra_parameters if you want to obtain the extra cost.
  ...
  1. regist the distiller in distiller_dict at mdistiller/distillers/__init__.py

  2. regist the corresponding hyper-parameters at mdistiller/engines/cfg.py

  3. create a new config file and test it.

Citation

If this repo is helpful for your research, please consider citing the paper:

@article{zhao2022dkd,
  title={Decoupled Knowledge Distillation},
  author={Zhao, Borui and Cui, Quan and Song, Renjie and Qiu, Yiyu and Liang, Jiajun},
  journal={arXiv preprint arXiv:2203.08679},
  year={2022}
}
@article{zhao2023dot,
  title={DOT: A Distillation-Oriented Trainer},
  author={Zhao, Borui and Cui, Quan and Song, Renjie and Liang, Jiajun},
  journal={arXiv preprint arXiv:2307.08436},
  year={2023}
}

License

MDistiller is released under the MIT license. See LICENSE for details.

Acknowledgement

  • Thanks for CRD and ReviewKD. We build this library based on the CRD's codebase and the ReviewKD's codebase.

  • Thanks Yiyu Qiu and Yi Shi for the code contribution during their internship in MEGVII Technology.

  • Thanks Xin Jin for the discussion about DKD.

Nearby in the ranking
Similar items