Knowledge Distillation(4)——Paying more attention to attention

PAYING MORE ATTENTION TO ATTENTION: IMPROVING THE PERFORMANCE OF CONVOLUTIONAL NEURAL NETWORKS VIA ATTENTION TRANSFER 论文阅读


IMPROVING THE PERFORMANCE OF CONVOLUTIONAL
NEURAL NETWORKS VIA ATTENTION TRANSFER 论文阅读

概述

不是soft target,不是隐含层hint,也不是特征变换的流程FSP(可参见专栏前三篇博客)。
本文将knowledge定义为anttention map,student模仿teacher的attention map:
Knowledge Distillation(4)——Paying more attention to attention

A gift from knowledge distillation是同一类的文章,只不过它是迁移的学习的过程,本文迁移的是注意力机制,都是迁移方式上的改进。
本文和FitNets也是一类的,FitNets迁移的是一个中间隐含层的输出,这个迁移的是attention map,且没有引入新的参数。related work部分还专门介绍了:
Knowledge Distillation(4)——Paying more attention to attention

ATTENTION TRANSFER

文章进行两种attention transfer方式,分别是activation-based和gradient-based,后者作者发现不太work,所以我下面主要介绍一下前者

Activation-based attention transfer

要把一个(C, H, W)映射成一个(H, W)的attention map,作者尝试定义了一些函数 FF

  1. 通道绝对值求和
  2. 绝对值指数求和
  3. 指数最大值
    Knowledge Distillation(4)——Paying more attention to attention
    为了知道哪个函数更合适,作者使用几个常见网络可视化其attention map结果:
    Knowledge Distillation(4)——Paying more attention to attention
    很显然,一些重要区域的**值都比较高(所以实验使用指数p=2,帮助提高这些区域的权重)
    Knowledge Distillation(4)——Paying more attention to attention
    作者以ResNet为例,对分辨率相同的feature计算attention map,又构造了一个AT loss
    Knowledge Distillation(4)——Paying more attention to attention
    Q只不过是把attention map展成向量,然后还进行了归一化操作,作者说这个对于student学习非常重要。
    Knowledge Distillation(4)——Paying more attention to attention
    不过第一项交叉损失是干啥的?那个是保证精度,进行hard label学习的Loss??但论文图五没体现啊
    下面这个也说了如果引入KD可以额外加一个loss,那上面第一项应该是hard label loss了。
    如果是KD+AT那就有三项loss,hard label,soft target、attention transfer:
    Knowledge Distillation(4)——Paying more attention to attention
    这样的方式训练完是作为pretrain还是直接就行了呢???如果这一就行了,这要比之前student学习teacher只是作为pretrain参数要优雅不少。奇怪的是作者并没有论述这一点,之前的模型为什么这样联合训练效果不理想,attention transfer为什么就能呢?
    很有可能也是作为pretrain但是作者没说清楚……

希望我能在其他论文找到这一答案吧……或者去看看代码吧

实验

可以看AT和KD那一栏,在不同模型上knowledge distillation感觉和attention transfer各有千秋,整体KD好一点吧。而且在KD基础上加入AT还能有提升!
Knowledge Distillation(4)——Paying more attention to attention