arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2212.12552cs.CVcs.AIcs.LG
收藏

空间建模:从注意力到卷积

A Close Look at Spatial Modeling: From Attention to Convolution

Northeastern University(东北大学);Meta Reality Labs(Meta现实实验室);Mila(米拉研究院)

Xu Ma, Huan Wang, Can Qin, Kunpeng Li, Xingchen Zhao, Jie Fu, Yun Fu

摘要:

视觉Transformer由于其富有洞察力的架构设计和注意力机制,在许多视觉任务中表现出了巨大的潜力。通过重新审视Transformers中的自我注意反应,我们从经验上观察到两个有趣的问题。首先,视觉Transformer在深层呈现查询无关行为,其中注意力地图在全局范围内表现出几乎一致的上下文,而不管查询补丁位置(也是头部无关)。其次,注意力地图本质上是稀疏的,很少有令牌支配注意力权重;从ConvNets引入知识将在很大程度上平滑注意力并提高性能。基于上述观察,我们推广了自注意公式,直接抽象出查询无关的全局上下文,并进一步将全局上下文集成到卷积中。得到的模型,全卷积视觉Transformer(即,FCViT是一种完全由卷积层组成的特征提取算法,它继承了注意力机制和卷积的优点,包括动态特性、权值共享、短距离和长距离特征建模等。使用不到14 M的参数,我们的FCViT-S12在ImageNet-1 K上的top1准确率比相关工作ResT-Lite高出3.7%。当将FCViT扩展到更大的模型时,我们仍然比以前最先进的ConvNeXt性能更好,参数更少。基于FCViT的模型还展示了对下游任务的有希望的可转移性,如目标检测、实例分割和语义分割。代码和模型可在https://github.com/ma-xu/FCViT上获得。

英文摘要:

Vision Transformers have shown great promise recently for many vision tasks due to the insightful architecture design and attention mechanism. By revisiting the self-attention responses in Transformers, we empirically observe two interesting issues. First, Vision Transformers present a queryirrelevant behavior at deep layers, where the attention maps exhibit nearly consistent contexts in global scope, regardless of the query patch position (also head-irrelevant). Second, the attention maps are intrinsically sparse, few tokens dominate the attention weights; introducing the knowledge from ConvNets would largely smooth the attention and enhance the performance. Motivated by above observations, we generalize self-attention formulation to abstract a queryirrelevant global context directly and further integrate the global context into convolutions. The resulting model, a Fully Convolutional Vision Transformer (i.e., FCViT), purely consists of convolutional layers and firmly inherits the merits of both attention mechanism and convolutions, including dynamic property, weight sharing, and short- and long-range feature modeling, etc. Experimental results demonstrate the effectiveness of FCViT. With less than 14M parameters, our FCViT-S12 outperforms related work ResT-Lite by 3.7% top1 accuracy on ImageNet-1K. When scaling FCViT to larger models, we still perform better than previous state-of-the-art ConvNeXt with even fewer parameters. FCViT-based models also demonstrate promising transferability to downstream tasks, like object detection, instance segmentation, and semantic segmentation. Codes and models are made available at: https://github.com/ma-xu/FCViT.

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

↑