还在魔改Transformer结构吗?微软&中山大学开源超强的视觉位置编码,涨点显著
极市导读
本文重新思考并改进相对位置编码在视觉Transformer中的使用,并提出了 4 种专门用于视觉Transformer的方法,并通过实验证明了在检测和分类任务上较大的性能提升。
写在前面
论文和代码地址

https://arxiv.org/abs/2107.14222
https://github.com/microsoft/AutoML/tree/main/iRPE
研究动机
方法
方法背景
绝对位置编码

相对位置编码

回顾相对位置编码
Shaw’s RPE

RPE in Transformer-XL

Huang’s RPE

RPE in SASA

相对位置编码的确定
Bias Mode and Contextual Mode




A Piecewise Index Function



2D Relative Position Calculation

Euclidean method

Quantization method

Cross method

Product method

高效实现


4.实验
相关位置编码分析
Directed-Bias v.s. Undirected-Contextual

Shared v.s. Unshared

Piecewise v.s. Clip.


Number of buckets

Component-wise analysis

Complexity Analysis

在图像分类任务上的表现

在目标检测任务上的表现

可视化

5. 总结
[2]. Zihang Dai, Zhilin Yang, Yiming Yang, Jaime G Carbonell,Quoc Le, and Ruslan Salakhutdinov. Transformer-xl: Attentive language models beyond a fixed-length context. In ACL,2019.
[3]. Zhiheng Huang, Davis Liang, Peng Xu, and Bing Xiang. Improve transformer models with better relative position embeddings. In EMNLP, 2020
[4]. Prajit Ramachandran, Niki Parmar, Ashish Vaswani, Irwan Bello, Anselm Levskaya, and Jonathon Shlens. Standalone self-attention in vision models. arXiv preprint arXiv:1906.05909, 2019.
如果觉得有用,就请分享到朋友圈吧!
赞 (0)
