[CVPR2022] Anomaly Detection via Reverse Distillation from One-Class Embedding
CVPR 2022
Link: [2201.10703] Anomaly Detection via Reverse Distillation from One-Class Embedding (arxiv.org)
Code: https://github.com/Merenguelkl/Reverse_Disstilation
1. Intro

提出一个新颖的知识蒸馏框架:Teacher Encoder + Student Decoder,并使用逆向蒸馏(Reverse Distillation),引入一个可训练的 one-class bottleneck embedding (OCBE) 模块作为bottleneck,该模块可以保留用于还原正常样本特征的信息。OCBE包含了multi-scale feature fusion block (MFF)
和 one-class embedding block (OCE)。
两个优点
1、非相似结构。若teacher和student模型使用相同或相似的网络结构,那在异常样本上输出的差异性不够;
2、紧凑的Embedding。喂给student网络的特征是去除了冗余信息的。
Contribution
1、提出了简单有效的逆向蒸馏方式,解决了传统知识蒸馏框架中non-distinguishing filter问题。
2、提出的OCBE模块将特征从高维投影到低维,去除了冗余信息。
3、MVTec-AD SOTA结果
2. Method

Overview
teacher E提取多尺度特征,训练student D从bottleneck embedding中还原这些特征,训练过程只在正常图像上进行。OCBE将多尺度特征聚合并降维到低维空间中供student D还原特征。
2.1 Reverse Distillation
将知识蒸馏和Encoder-Decoder框架融合,蒸馏过程为student Decoder通过bottleneck embedding先还原深层特征(high level),再浅层特征(low level)。
训练时Teacher Encoder不进行权重更新,只训练OCBE和Student Decoder。
Student Decoder使用和Teacher Encoder对称的网络架构,目的是让相对应位置的特征维度一致。
e.g. 当Teacher Encoder使用参数为kernel size = 1,stride = 2的卷积操作时时,Student Decoder 使用kernel size = 2,stride = 2的反卷积操作。
Loss
在每一组feature map上计算一张anomaly map,计算方法为在通道维上计算余弦相似度。得到的anomaly map尺寸与相应位置feature map尺寸一致。
loss函数为每张anomaly map的数值平均求累加:
2.2 One-Class Bottleneck Embedding (OCBE)
若直接使用Encoder最后一层特征(原始bottleneck),有两个缺点:
1、维度太高,包含大量冗余信息;
2、最后一层特征包含高级特征(语义等),难以直接送入Decoder进行还原低级特征
为了客服以上缺点,提出了可训练的One-Class Bottleneck Embedding(OCBE)来降维并融合多level的特征,包含MFF和OCE
MFF
用于融合多级别特征,为了使得特征维度相同,对高级特征应用一个或多个大小为33,步长为2的卷积操作,并接有BN和ReLU。特征维度相同后进行拼接(concat),然后经过一个11的卷积核来降低通道数。
OCE
使用一个ResBlock得到更加适合用于Decoder还原Encoder特征的Bottleneck Embedding
2.3 Anomaly Scoring
像素级别
在Inference阶段,输入一张测试图像会得到L张Anomaly Map,对它们进行双线性上采样到原始图像大小,并进行相加,最终得到像素级别Anomaly Map,使用高斯模糊进行平滑处理。
图像级别
取Anomaly Map的最大值作为图像级别异常分数。
3. Experiment
3.1 Defect Detection
数据集:MVTec-AD
图像级别

像素级别

异常分数分布
3.2 Semantic Anomaly Detection
数据集:CIFAR-10、MNIST、F-MNIST

4. Ablation
4.1 with/without OCBE

4.3 Multi-Scale Feature

4.2 Different Backbones
