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

用于视觉Transformer的条件位置编码

Conditional Positional Encodings for Vision Transformers

Meituan Inc.(美团公司);Beijing Academy of AI(北京人工智能研究院);Zhejiang University(浙江大学)

Xiangxiang Chu, Zhi Tian, Bo Zhang, Xinlong Wang, Chunhua Shen

摘要:

我们提出了一个条件位置编码(CPE)方案的视觉Transformer。与之前的固定或可学习的位置编码不同,CPE是动态生成的,并以输入标记的局部邻域为条件。因此,CPE可以很容易地推广到比模型在训练过程中看到的更长的输入序列。此外,CPE在图像分类任务中可以保持期望的不变性,从而提高性能。我们用一个简单的位置编码生成器(PEG)实现CPE,以无缝地集成到当前的Transformer框架中。在PEG的基础上,我们提出了条件位置编码视觉Transformer(CPVT)。我们证明,CPVT有视觉上相似的注意力地图相比,那些与学习位置编码,并提供优于结果。我们的代码可在https://github.com/Meituan-AutoML/CPVT上获得。

英文摘要:

We propose a conditional positional encoding (CPE) scheme for vision Transformers. Unlike previous fixed or learnable positional encodings, which are pre-defined and independent of input tokens, CPE is dynamically generated and conditioned on the local neighborhood of the input tokens. As a result, CPE can easily generalize to the input sequences that are longer than what the model has ever seen during training. Besides, CPE can keep the desired translation-invariance in the image classification task, resulting in improved performance. We implement CPE with a simple Position Encoding Generator (PEG) to get seamlessly incorporated into the current Transformer framework. Built on PEG, we present Conditional Position encoding Vision Transformer (CPVT). We demonstrate that CPVT has visually similar attention maps compared to those with learned positional encodings and delivers outperforming results. Our code is available at https://github.com/Meituan-AutoML/CPVT .

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

↑