[论文解读] What do Vision Transformers Learn? A Visual Exploration
本文通过可视化 Vision Transformer (ViTs) 来理解它们学习了什么,结果显示:使用语言监督训练的 ViTs 对语义概念有响应,能够在最后一层保留空间信息,并且比 CNN 更依赖背景线索,最后一层的 token 混合类似于学习得到的池化。
Vision transformers (ViTs) are quickly becoming the de-facto architecture for computer vision, yet we understand very little about why they work and what they learn. While existing studies visually analyze the mechanisms of convolutional neural networks, an analogous exploration of ViTs remains challenging. In this paper, we first address the obstacles to performing visualizations on ViTs. Assisted by these solutions, we observe that neurons in ViTs trained with language model supervision (e.g., CLIP) are activated by semantic concepts rather than visual features. We also explore the underlying differences between ViTs and CNNs, and we find that transformers detect image background features, just like their convolutional counterparts, but their predictions depend far less on high-frequency information. On the other hand, both architecture types behave similarly in the way features progress from abstract patterns in early layers to concrete objects in late layers. In addition, we show that ViTs maintain spatial information in all layers except the final layer. In contrast to previous works, we show that the last layer most likely discards the spatial information and behaves as a learned global pooling operation. Finally, we conduct large-scale visualizations on a wide range of ViT variants, including DeiT, CoaT, ConViT, PiT, Swin, and Twin, to validate the effectiveness of our method.
研究动机与目标
- 通过改进的特征可视化技术研究 ViTs 学习的内容。
- 在空间信息维持和对背景与前景线索的依赖方面,将 ViTs 与 CNN 进行比较。
- 评估语言监督的 ViTs(如 CLIP)在特征表示上与标准图像分类 ViTs 的差异。
- 考察 ViTs 的最后一层如何实现信息全球化,以及各层如何维持空间信息。
提出的方法
- 为 ViTs 定制基于梯度的激活最大化框架,实现对高维前馈特征的可解释可视化。
- 可视化并比较键(keys)、查询(queries)、值(values)及前馈输出,以评估各层的可解释性。
- 使用增强投票集成、全变性正则化和特定图像增强(抖动、颜色偏移、高斯平滑)来提升可视化质量。
- 分析分块激活图以评估空间信息的保留以及 CLS 与非 CLS 令牌的行为。
- 在 ViT 的多种变体(ViT-B16、DeiT、CoaT、ConViT、PiT、Swin、Twin)上进行大规模可视化以验证方法鲁棒性。
实验结果
研究问题
- RQ1ViTs 如何在各层中对内部表示进行可视化与解释?
- RQ2ViTs 是否在补丁级别上保留空间信息,且在最后一层这种保留如何变化?
- RQ3ViT 的最后一层如何混合令牌,这是否等同于池化或全球化?
- RQ4ViTs 与 CNN 在使用背景信息还是前景信息进行分类方面有何差异?
- RQ5语言监督(CLIP)对 ViT 的特征表示有何影响?
主要发现
- ViTs 的前馈表示最易于解释,而注意力组件(键/查询/值)由于高维度、类多模态编码而较难解释。
- ViTs 的分块激活图在大多数层面上类似于显著性图并保持分块级空间关系,只有在最后一层出现例外。
- 最后一层执行与平均池化相似的令牌混合,使 CLS 令牌实现全局信息聚合(即使对单个分块应用时也如此)。
- ViTs 在识别正确类别时往往比 CNN 更有效地利用背景信息,且在移除背景时性能下降较小;但 CNN 更依赖高频纹理信息。
- 使用 CLIP 训练的 ViTs 展现出语义和概念性特征(如病态概念、音乐相关概念),超出简单对象检测,反映语言监督塑造了表示。
- ViTs 在各层保留空间信息,并呈现从纹理到部件再到对象的演进,与 CNN 相似;语言监督推动向抽象概念发展。
更好的研究,从现在开始
从论文设计到论文写作,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。