arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2501.16182cs.CVcs.AI
收藏

线性注意力在 Vision Transformer 中的复兴

The Linear Attention Resurrection in Vision Transformer

Chuanyang Zheng

AI总结:

本文针对 ViT 的 softmax 注意力二次复杂度问题,提出融合增强线性全局注意力与局部窗口注意力的 L$^2$ViT,在保持线性复杂度的同时提升分类、检测和分割性能。

摘要:

Vision Transformer(ViT)近来在计算机视觉领域风靡。然而,ViT 底层的 softmax 注意力在时间和内存上都具有二次复杂度,阻碍了 ViT 应用于高分辨率图像。我们重新审视注意力设计,并提出一种线性注意力方法来解决这一限制;与现有方法(例如 Swin 的局部窗口注意力)不同,该方法不会牺牲 ViT 捕获全局表征这一核心优势。我们进一步研究了线性注意力与 softmax 注意力之间的关键差异。实验结果表明,线性注意力缺乏集中注意力矩阵分布这一基本属性。受此观察启发,我们引入了一个局部集中模块来增强线性注意力。通过结合增强的线性全局注意力与局部窗口注意力,我们提出了一种新的 ViT 架构,称为 L$^2$ViT。值得注意的是,L$^2$ViT 能够有效捕获全局交互和局部表征,同时享有线性计算复杂度。大量实验证明了 L$^2$ViT 的强劲性能。在图像分类方面,L$^2$ViT 在没有任何额外训练数据或标签的情况下,在 ImageNet-1K 上达到 84.4% 的 Top-1 准确率。通过进一步在 ImageNet-22k 上进行预训练,在以 384$^2$ 分辨率微调时,它达到 87.0%。对于下游任务,L$^2$ViT 作为骨干网络在目标检测和语义分割上均取得了良好性能。

英文摘要:

Vision Transformers (ViTs) have recently taken computer vision by storm. However, the softmax attention underlying ViTs comes with a quadratic complexity in time and memory, hindering the application of ViTs to high-resolution images. We revisit the attention design and propose a linear attention method to address the limitation, which doesn't sacrifice ViT's core advantage of capturing global representation like existing methods (e.g. local window attention of Swin). We further investigate the key difference between linear attention and softmax attention. Our empirical results suggest that linear attention lacks a fundamental property of concentrating the distribution of the attention matrix. Inspired by this observation, we introduce a local concentration module to enhance linear attention. By incorporating enhanced linear global attention and local window attention, we propose a new ViT architecture, dubbed L$^2$ViT. Notably, L$^2$ViT can effectively capture both global interactions and local representations while enjoying linear computational complexity. Extensive experiments demonstrate the strong performance of L$^2$ViT. On image classification, L$^2$ViT achieves 84.4% Top-1 accuracy on ImageNet-1K without any extra training data or label. By further pre-training on ImageNet-22k, it attains 87.0% when fine-tuned with resolution 384$^2$. For downstream tasks, L$^2$ViT delivers favorable performance as a backbone on object detection as well as semantic segmentation.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑