首次可视化ViT模型决策过程中的注意力演化动态。
Dynamic Accumulated Attention Map for Interpreting Evolution of Decision-Making in Vision Transformer
- 通过分解每个模块的[cls] token,提取空间与通道重要性信息。
- 构建逐层累积的注意力图,揭示注意力从输入到输出的演变路径。
- 适用于带分类头和自监督的ViT模型,解释力强且可复现。
现有视觉变压器(ViT)模型在图像识别中广泛应用,但现有可视化方法无法展示其内部结构中隐藏的注意力流动过程,即最终关注区域如何逐步形成以支持决策。本文提出一种新型可视化方法——动态累积注意力图(DAAM),首次实现对ViT网络中从顶层到底层的注意力流动进行可视化。为此,设计了一种新分解模块,通过解码每个ViT块中自注意力模块生成的[cls] token,获取空间特征信息并存储。对于有监督的ViT模型,该模块还可通过分解分类得分获得通道重要性系数;针对无监督的自监督模型,则提出按维度计算重要性权重来替代分类得分。将这些空间特征与对应通道重要性系数线性结合,形成每个块的注意力图。通过逐块累积,揭示动态注意力演化过程。定量与定性分析一致证明,该方法不仅适用于带有全连接分类器的ViT模型,也适用于自监督ViT模型,具有优异的解释能力。代码已开源:https://github.com/ly9802/DynamicAccumulatedAttentionMap。
原文摘要 · Abstract (English)
Various Vision Transformer (ViT) models have been widely used for image recognition tasks. However, existing visual explanation methods can not display the attention flow hidden inside the inner structure of ViT models, which explains how the final attention regions are formed inside a ViT for its decision-making. In this paper, a novel visual explanation approach, Dynamic Accumulated Attention Map (DAAM), is proposed to provide a tool that can visualize, for the first time, the attention flow from the top to the bottom through ViT networks. To this end, a novel decomposition module is proposed to construct and store the spatial feature information by unlocking the [class] token generated by the self-attention module of each ViT block. The module can also obtain the channel importance coefficients by decomposing the classification score for supervised ViT models. Because of the lack of classification score in self-supervised ViT models, we propose dimension-wise importance weights to compute the channel importance coefficients. Such spatial features are linearly combined with the corresponding channel importance coefficients, forming the attention map for each block. The dynamic attention flow is revealed by block-wisely accumulating each attention map. The contribution of this work focuses on visualizing the evolution dynamic of the decision-making attention for any intermediate block inside a ViT model by proposing a novel decomposition module and dimension-wise importance weights. The quantitative and qualitative analysis consistently validate the effectiveness and superior capacity of the proposed DAAM for not only interpreting ViT models with the fully-connected layers as the classifier but also self-supervised ViT models. The code is available at https://github.com/ly9802/DynamicAccumulatedAttentionMap.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。