All Projects → yoshitomo-matsubara → Torchdistill

yoshitomo-matsubara / Torchdistill

Licence: mit
PyTorch-based modular, configuration-driven framework for knowledge distillation. 🏆18 methods including SOTA are implemented so far. 🎁 Trained models, training logs and configurations are available for ensuring the reproducibiliy.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Torchdistill

Swin-Transformer
This is an official implementation for "Swin Transformer: Hierarchical Vision Transformer using Shifted Windows".
Stars: ✭ 8,046 (+4445.76%)
Mutual labels:  imagenet, image-classification, semantic-segmentation
Imgclsmob
Sandbox for training deep learning networks
Stars: ✭ 2,405 (+1258.76%)
Mutual labels:  semantic-segmentation, image-classification, imagenet
Awesome Computer Vision Models
A list of popular deep learning models related to classification, segmentation and detection problems
Stars: ✭ 278 (+57.06%)
Mutual labels:  object-detection, semantic-segmentation, image-classification
Pytorch Hardnet
35% faster than ResNet: Harmonic DenseNet, A low memory traffic network
Stars: ✭ 293 (+65.54%)
Mutual labels:  object-detection, semantic-segmentation, imagenet
Neural Backed Decision Trees
Making decision trees competitive with neural networks on CIFAR10, CIFAR100, TinyImagenet200, Imagenet
Stars: ✭ 411 (+132.2%)
Mutual labels:  image-classification, imagenet, cifar10
super-gradients
Easily train or fine-tune SOTA computer vision models with one open source training library
Stars: ✭ 429 (+142.37%)
Mutual labels:  imagenet, image-classification, semantic-segmentation
Aognet
Code for CVPR 2019 paper: " Learning Deep Compositional Grammatical Architectures for Visual Recognition"
Stars: ✭ 132 (-25.42%)
Mutual labels:  image-classification, imagenet, cifar10
BottleneckTransformers
Bottleneck Transformers for Visual Recognition
Stars: ✭ 231 (+30.51%)
Mutual labels:  imagenet, image-classification, cifar10
Rectlabel Support
RectLabel - An image annotation tool to label images for bounding box object detection and segmentation.
Stars: ✭ 338 (+90.96%)
Mutual labels:  object-detection, image-classification, imagenet
Rexnet
Official Pytorch implementation of ReXNet (Rank eXpansion Network) with pretrained models
Stars: ✭ 319 (+80.23%)
Mutual labels:  object-detection, image-classification, imagenet
Petridishnn
Code for the neural architecture search methods contained in the paper Efficient Forward Neural Architecture Search
Stars: ✭ 112 (-36.72%)
Mutual labels:  image-classification, imagenet, cifar10
Cvat
Powerful and efficient Computer Vision Annotation Tool (CVAT)
Stars: ✭ 6,557 (+3604.52%)
Mutual labels:  semantic-segmentation, image-classification, imagenet
Involution
[CVPR 2021] Involution: Inverting the Inherence of Convolution for Visual Recognition, a brand new neural operator
Stars: ✭ 252 (+42.37%)
Mutual labels:  object-detection, semantic-segmentation, image-classification
Gluon Cv
Gluon CV Toolkit
Stars: ✭ 5,001 (+2725.42%)
Mutual labels:  object-detection, semantic-segmentation, image-classification
Label Studio
Label Studio is a multi-type data labeling and annotation tool with standardized output format
Stars: ✭ 7,264 (+4003.95%)
Mutual labels:  semantic-segmentation, image-classification, imagenet
Tensorflow2.0 Examples
🙄 Difficult algorithm, Simple code.
Stars: ✭ 1,397 (+689.27%)
Mutual labels:  object-detection, image-classification
Pytorch cpp
Deep Learning sample programs using PyTorch in C++
Stars: ✭ 114 (-35.59%)
Mutual labels:  object-detection, semantic-segmentation
Regnet
Pytorch implementation of network design paradigm described in the paper "Designing Network Design Spaces"
Stars: ✭ 129 (-27.12%)
Mutual labels:  image-classification, imagenet
Efficientdet.pytorch
Implementation EfficientDet: Scalable and Efficient Object Detection in PyTorch
Stars: ✭ 1,383 (+681.36%)
Mutual labels:  object-detection, coco
Labelbox
Labelbox is the fastest way to annotate data to build and ship computer vision applications.
Stars: ✭ 1,588 (+797.18%)
Mutual labels:  image-classification, imagenet

torchdistill: A Modular, Configuration-Driven Framework for Knowledge Distillation

PyPI version Build Status

torchdistill (formerly kdkit) offers various knowledge distillation methods and enables you to design (new) experiments simply by editing a yaml file instead of Python code. Even when you need to extract intermediate representations in teacher/student models, you will NOT need to reimplement the models, that often change the interface of the forward, but instead specify the module path(s) in the yaml file.

Forward hook manager

Using ForwardHookManager, you can extract intermediate representations in model without modifying the interface of its forward function.
This example notebook will give you a better idea of the usage.

1 experiment → 1 PyYAML config file

In torchdistill, many components and PyTorch modules are abstracted e.g., models, datasets, optimizers, losses, and more! You can define them in a PyYAML config file so that can be seen as a summary of your experiment, and in many cases, you will NOT need to write Python code at all. Take a look at some configurations available in configs/. You'll see what modules are abstracted and how they are defined in a PyYAML config file to design an experiment.

Top-1 validation accuracy for ILSVRC 2012 (ImageNet)

T: ResNet-34* Pretrained KD AT FT CRD Tf-KD SSKD L2 PAD-L2
S: ResNet-18 69.76* 71.37 70.90 71.56 70.93 70.52 70.09 71.08 71.71
Original work N/A N/A 70.70 71.43** 71.17 70.42 71.62 70.90 71.71

* The pretrained ResNet-34 and ResNet-18 are provided by torchvision.
** FT is assessed with ILSVRC 2015 in the original work.
For the 2nd row (S: ResNet-18), the checkpoint (trained weights), configuration and log files are available, and the configurations reuse the hyperparameters such as number of epochs used in the original work except for KD.

Examples

Executable code can be found in examples/ such as

For CIFAR-10 and CIFAR-100, some models are reimplemented and available as pretrained models in torchdistill. More details can be found here.

Google Colab Examples

CIFAR-10 and CIFAR-100

  • Training without teacher models Open In Colab
  • Knowledge distillation Open In Colab

These examples are available in demo/. Note that the examples are for Google Colab users, and usually examples/ would be a better reference if you have your own GPU(s).

Citation

[Preprint]

@article{matsubara2020torchdistill,
  title={torchdistill: A Modular, Configuration-Driven Framework for Knowledge Distillation},
  author={Matsubara, Yoshitomo},
  year={2020}
  eprint={2011.12913},
  archivePrefix={arXiv},
  primaryClass={cs.LG}
}

How to setup

  • Python 3.6 >=
  • pipenv (optional)

Install by pip/pipenv

pip3 install torchdistill
# or use pipenv
pipenv install torchdistill

Install from this repository

git clone https://github.com/yoshitomo-matsubara/torchdistill.git
cd torchdistill/
pip3 install -e .
# or use pipenv
pipenv install "-e ."

Issues / Contact

The documentation is work-in-progress. In the meantime, feel free to create an issue if you have a feature request or email me ( [email protected] ) if you would like to ask me in private.

References

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].