Branch Log · Open in interactive viewer →

10 Knowledge Distillation

Lecture 10 - Knowledge Distillation | MIT 6.S965

EfficientML.ai Lecture 9 - Knowledge Distillation (MIT 6.5940, Fall 2023, Zoom)


10.5 KD for Object Detection

Object Detection 도메인에서는, 크게 두 가지 문제를 추가로 해결해야 한다.

이때, bounding box는 classification이 아니라, regression 문제에 해당된다.


10.5.1 Distillation Pipeline for Object Detection

Learning Efficient Object Detection Models with Knowledge Distillation 논문(2017)

Object Detection의 특징에 맞춰, 위 논문에서는 다음과 같은 절차를 통해 KD를 수행한다.

feature imitation

교사와 학생의 intermediate feature map을 비교한다.

1x1 conv로 channel 수를 맞춘다.

LHint(V,Z)=||VZ||22

classification, regression 결과를 모두 도출한 뒤 loss를 계산한다.

Lb(Rs,Rt,y)={||Rsy||22,if||Rsy||22+m>||Rty||220,otherwise

이때 margin을 두어, 학생 성능이 교사 성능 + margin m 을 넘어서는 순간, loss가 0이 되며 학습이 중단되도록 구현했다.


10.5.2 Convert Regression to Classification Problem

Localization Distillation for Dense Object Detection 논문(2022)

혹은 regression 문제인 bounding box을, classification 문제로 바꿔서 KD를 수행할 수 있다.

bounding box


10.6 KD for Semantic Segmentation

Structured Knowledge Distillation for Semantic Segmentation 논문(2019)

Semantic Segmentation 도메인에서는 Discriminator을 사용한 KD 방법이 제안되었다. (Adversarial Distillation)

structured KD

adversarial loss: 학생이 discriminator를 속일 수 있도록 학습된다.


10.7 KD for GAN

GAN Compression: Efficient Architectures for Interactive Conditional GANs 논문(2020)

KD for GAN

training objective는 다음과 같다.

=cGAN(x)+λreconrecon+λdistilldistill(x) recon={||G(x)y||paired cGANs||G(x)G(x)||unpaired cGANs distill=k=1n||Gk(x)fk(Gk(x))|| cGANLoss

\mathcal{L}{cGAN} = \mathbb{E}_x[\log (1- D(x, G(x)))]}[\log D(x,y)] + \mathbb{E

##10.8KDforNLP>[MobileBERT:aCompactTaskAgnosticBERTforResourceLimitedDevices(2020)](https://arxiv.org/abs/2004.02984)MobileBERTNLP,featuremapattentionKD.![MobileBERT](https://raw.githubusercontent.com/erectbranch/MITEfficientAI/master/2022/lec10/summary02/images/NLPKD.png)FeatureMapTransfer(FMT)AttentionTransfer(AT)##10.9NetworkAugmentation>[NETWORKAUGMENTATIONFORTINYDEEPLEARNING(2022)](https://arxiv.org/pdf/2110.08890.pdf)largemodeloverfitting**dataaugmentation**,**dropout**,tinymodel.dataaugmentationcutout,mixup,rotation,flip![dataaugmentation](https://raw.githubusercontent.com/erectbranch/MITEfficientAI/master/2022/lec10/summary02/images/dataaugmentation.png)dropout![dropout](https://raw.githubusercontent.com/erectbranch/MITEfficientAI/master/2022/lec10/summary02/images/dropout.png)tinymodel,.![AutoAugment,dropout](https://raw.githubusercontent.com/erectbranch/MITEfficientAI/master/2022/lec10/summary02/images/dataaugmentdropoutcompare.png)###10.9.1TrainingProcess**NetAug**.(reversedropout)>largemodeloverfitting.augmentmodel#channels,dynamicneuralnetwork.(**weightsharing**)Step1original,augmentedmodelforward,backward.![NetAugstep1](https://github.com/erectbranch/MITEfficientAI/blob/master/2022/lec10/summary02/images/NetAugstep1.png)>:originaltinymodel,:augmentedmodellossfunctionbasesupervision,auxiliarysupervision.

{\mathcal{L} }{aug} = {\mathcal{L} }(W]) $$}) + {\alpha}{\mathcal{L} }([W_{base}, W_{aug


10.9.2 NetAug Learning Curve

다음은 ImageNet 데이터셋을 이용한 학습에서 NetAug를 적용했을 때의 성능을 나타낸 그림이다.

Learning curves on ImageNet