Skip to main content
QUICK REVIEW

[论文解读] DaViT: Dual Attention Vision Transformers

Mingyu Ding, Bin Xiao|arXiv (Cornell University)|Apr 7, 2022
Advanced Neural Network Applications被引用 11
一句话总结

DaViT 在视觉变换器中引入了一种双注意力机制,联合建模空间和通道自注意力,以高效捕捉局部细粒度与全局上下文表征。通过在空间标记和转置通道标记上应用自注意力,并通过分组机制保持线性复杂度,DaViT 在保持计算效率的同时实现了最先进性能——在 ImageNet-1K 上达到 84.6% 的 top-1 准确率,参数量为 87.9M。

ABSTRACT

In this work, we introduce Dual Attention Vision Transformers (DaViT), a simple yet effective vision transformer architecture that is able to capture global context while maintaining computational efficiency. We propose approaching the problem from an orthogonal angle: exploiting self-attention mechanisms with both "spatial tokens" and "channel tokens". With spatial tokens, the spatial dimension defines the token scope, and the channel dimension defines the token feature dimension. With channel tokens, we have the inverse: the channel dimension defines the token scope, and the spatial dimension defines the token feature dimension. We further group tokens along the sequence direction for both spatial and channel tokens to maintain the linear complexity of the entire model. We show that these two self-attentions complement each other: (i) since each channel token contains an abstract representation of the entire image, the channel attention naturally captures global interactions and representations by taking all spatial positions into account when computing attention scores between channels; (ii) the spatial attention refines the local representations by performing fine-grained interactions across spatial locations, which in turn helps the global information modeling in channel attention. Extensive experiments show our DaViT achieves state-of-the-art performance on four different tasks with efficient computations. Without extra data, DaViT-Tiny, DaViT-Small, and DaViT-Base achieve 82.8%, 84.2%, and 84.6% top-1 accuracy on ImageNet-1K with 28.3M, 49.7M, and 87.9M parameters, respectively. When we further scale up DaViT with 1.5B weakly supervised image and text pairs, DaViT-Gaint reaches 90.4% top-1 accuracy on ImageNet-1K. Code is available at https://github.com/dingmyu/davit.

研究动机与目标

  • 解决视觉变换器中全局上下文建模与计算效率之间的权衡问题。
  • 设计一种机制,在不引入空间分辨率下二次复杂度的情况下捕捉全局长距离依赖。
  • 探索空间自注意力与通道自注意力在提升表征学习中的互补作用。
  • 证明双注意力机制可在更少参数量和 FLOPs 下超越标准的局部或全局自注意力。
  • 评估移除前馈网络(FFNs)以采用更深的纯注意力架构的有效性。

提出的方法

  • 引入两类标记:基于补丁的空间标记和基于特征的通道标记,其中注意力机制在通道维度上应用,以建模全局图像上下文。
  • 对转置的特征图应用自注意力,生成每个代表图像所有空间位置全局视图的通道标记。
  • 沿序列维度对空间标记和通道标记进行分组,以保持与序列长度呈线性关系的计算复杂度。
  • 在双注意力模块中交替使用空间窗口自注意力与通道组自注意力,以优化局部与全局表征。
  • 通过移除 FFNs 并用更深的双注意力模块堆叠来实现轻量化、参数高效的结构,以匹配 FLOP 预算。
  • 采用分组查询与键的通道组自注意力,以降低计算成本,同时保持全局建模能力。

实验结果

研究问题

  • RQ1联合建模空间与通道自注意力是否能在不增加计算成本的前提下提升视觉变换器的全局上下文建模能力?
  • RQ2在准确率与效率方面,双注意力相较于标准窗口注意力或全局自注意力表现如何?
  • RQ3无前馈网络的纯注意力架构是否能在图像分类任务上实现强性能?
  • RQ4在全局特征表示上运行的通道自注意力是否优于传统通道注意力模块(如 SE 和 ECA)?
  • RQ5双注意力机制在多大程度上减少了达到最先进性能所需的层数?

主要发现

  • DaViT-Base 在 ImageNet-1K 上达到 84.6% 的 top-1 准确率,仅使用 87.9M 参数和 15.2 GFLOPs,优于同等 FLOP 水平下的先前最先进方法。
  • DaViT-Tiny 在 ImageNet-1K 上达到 82.8% 的 top-1 准确率,参数量为 28.3M,FLOPs 为 4.5,展现出优异的效率-准确率权衡。
  • 无 FFNs 的纯注意力版本 DaViT 在 ImageNet-1K 上达到 82.5% 的 top-1 准确率,优于窗口注意力与通道注意力基线方法 1.5–1.7%。
  • DaViT-Giant 在 15 亿个弱监督图像-文本对上预训练,ImageNet-1K 上达到 90.4% 的 top-1 准确率,展现出强大的可扩展性。
  • DaViT 模型的吞吐量高于 Swin Transformer(例如,Tiny 模型在 V100 上分别达到 1059 vs. 1024 张样本/秒),表明其推理效率更优。
  • 将通道自注意力替换为 SE 或 ECA 块会使准确率下降 1.6%,证实所提出的注意力机制在全局特征融合方面更有效。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。