LocalViT:分析视觉Transformer中的局部性
LocalViT: Analyzing Locality in Vision Transformers
AI总结:
本文研究视觉Transformer的局部性机制,通过在前馈网络中添加局部性(灵感来自前馈网络与倒置残差块的比较),经对照实验验证其性能提升和泛化性,在ImageNet2012上优于多个基线模型。
摘要:
本文旨在研究视觉Transformer中局部性机制的影响。Transformer起源于机器翻译,尤其擅长对长序列内的长程依赖关系进行建模。尽管Transformer的自注意力机制能很好地建模token嵌入之间的全局交互,但缺乏局部区域内信息交换的局部性机制。本文通过精心设计的对照实验系统地研究了局部性机制。我们将局部性添加到视觉Transformer的前馈网络中。这一看似简单的解决方案灵感来自前馈网络与倒置残差块的比较。局部性机制的重要性通过两种方式得到验证:1)有多种设计选择(激活函数、层位置、扩展比)可用于整合局部性机制,适当选择可带来优于基线的性能提升;2)相同的局部性机制成功应用于不同架构设计的视觉Transformer,显示了局部性概念的泛化性。在ImageNet2012分类任务中,增强局部性的Transformer在参数数量和计算量增加可忽略不计的情况下,比基线模型Swin-T、DeiT-T和PVT-T分别高出1.0%、2.6%和3.1%。代码可在https://github.com/ofsoundof/LocalViT获取。
英文摘要:
The aim of this paper is to study the influence of locality mechanisms in vision transformers. Transformers originated from machine translation and are particularly good at modelling long-range dependencies within a long sequence. Although the global interaction between the token embeddings could be well modelled by the self-attention mechanism of transformers, what is lacking is a locality mechanism for information exchange within a local region. In this paper, locality mechanism is systematically investigated by carefully designed controlled experiments. We add locality to vision transformers into the feed-forward network. This seemingly simple solution is inspired by the comparison between feed-forward networks and inverted residual blocks. The importance of locality mechanisms is validated in two ways: 1) A wide range of design choices (activation function, layer placement, expansion ratio) are available for incorporating locality mechanisms and proper choices can lead to a performance gain over the baseline, and 2) The same locality mechanism is successfully applied to vision transformers with different architecture designs, which shows the generalization of the locality concept. For ImageNet2012 classification, the locality-enhanced transformers outperform the baselines Swin-T, DeiT-T, and PVT-T by 1.0%, 2.6% and 3.1% with a negligible increase in the number of parameters and computational effort. Code is available at https://github.com/ofsoundof/LocalViT.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。