Distilling Knowledge by Mimicking Features

Guo-Hua Wang, Yifan Ge, Jianxin Wu
11/3/2020
cs.CVcs.LG

Official code: DoctorKey/LSHFM.singleclassification (7 stars, PyTorch, last commit 2022-03-09). 2 more implementations below.

Abstract

Knowledge distillation (KD) is a popular method to train efficient networks ("student") with the help of high-capacity networks ("teacher"). Traditional methods use the teacher's soft logits as extra supervision to train the student network. In this paper, we argue that it is more advantageous to make the student mimic the teacher's features in the penultimate layer. Not only the student can directly learn more effective information from the teacher feature, feature mimicking can also be applied for teachers trained without a softmax layer. Experiments show that it can achieve higher accuracy than traditional KD. To further facilitate feature mimicking, we decompose a feature vector into the magnitude and the direction. We argue that the teacher should give more freedom to the student feature's magnitude, and let the student pay more attention on mimicking the feature direction. To meet this requirement, we propose a loss term based on locality-sensitive hashing (LSH). With the help of this new loss, our method indeed mimics feature directions more accurately, relaxes constraints on feature magnitudes, and achieves state-of-the-art distillation accuracy. We provide theoretical analyses of how LSH facilitates feature direction mimicking, and further extend feature mimicking to multi-label recognition and object detection.

View on arXivView PDF

Code Implementations(3)

PyTorch

Single-class image classification of Distilling Knowledge by Mimicking Features.

73PythonJan 26, 20224 years ago
image-classificationknowledge-distillationpython3pytorch
PyTorch

Multi-class image classification of Distilling Knowledge by Mimicking Features.

50PythonJan 28, 20224 years ago
image-classificationknowledge-distillationmulticlass-classificationpython3pytorch
PyTorch

Object detection of Distilling Knowledge by Mimicking Features.

52Shell, PythonJan 26, 20224 years ago
knowledge-distillationobject-detectionpythonpytorch

Similar Papers

Cite this paper

@article{wang2020distilling,
  title  = {Distilling Knowledge by Mimicking Features},
  author = {Guo-Hua Wang and Yifan Ge and Jianxin Wu},
  year   = {2020},
  eprint = {2011.01424},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2011.01424}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2011.01424.svg)](https://codeofpaper.com/paper/2011.01424)

Discussion