[论文解读] Twins: Revisiting the Design of Spatial Attention in Vision Transformers
本文提出了两种视觉变换器骨干网络 Twins-PCPVT 与 Twins-SVT,引入一种简单但有效的空间注意力设计,将条件位置编码与全局子采样和局部分组注意力相结合,在分类、分割和检测任务中实现高效计算的同时取得出色结果。
Very recently, a variety of vision transformer architectures for dense prediction tasks have been proposed and they show that the design of spatial attention is critical to their success in these tasks. In this work, we revisit the design of the spatial attention and demonstrate that a carefully-devised yet simple spatial attention mechanism performs favourably against the state-of-the-art schemes. As a result, we propose two vision transformer architectures, namely, Twins-PCPVT and Twins-SVT. Our proposed architectures are highly-efficient and easy to implement, only involving matrix multiplications that are highly optimized in modern deep learning frameworks. More importantly, the proposed architectures achieve excellent performance on a wide range of visual tasks, including image level classification as well as dense detection and segmentation. The simplicity and strong performance suggest that our proposed architectures may serve as stronger backbones for many vision tasks. Our code is released at https://github.com/Meituan-AutoML/Twins .
研究动机与目标
- 重新审视并改进视觉变换器在密集预测任务中的空间注意力设计。
- 证明一种简单而高效的注意力设计在降低计算量的前提下可以匹配或超过最先进的骨干网络。
- 提供两种架构(Twins-PCPVT 和 Twins-SVT),在图像级和像素级视觉任务上均有良好表现。
- 展示位置编码和注意力设计选择对性能与部署效率具有关键影响。
提出的方法
- 通过将PVT的绝对位置编码替换为条件位置编码(CPE),并在每个阶段的第一个编码器块之后使用位置编码生成器(PEG),引入 Twins-PCPVT。
- 提出 Twins-SVT,具空间可分离自注意力(SSSA),将局部分组自注意力(LSA)与全局子采样注意力(GSA)结合,以平衡局部与全局信息。
- 将 SSSA 表述为一系列 LayerNorm、注意力/FFN 块及残差连接,类似于标准变换器。
- 使用 PEG/CPE 进行位置编码,以处理可变输入尺寸并提高旋转不变性。
- 在 ImageNet-1K、ADE20K、COCO(使用 RetinaNet 与 Mask R-CNN)上对模型进行基准测试,以评估分类、分割与检测性能。
- 通过避免窗口移位操作并实现高效矩阵乘法,凸显相对于 Swin 的部署优势。
实验结果
研究问题
- RQ1一种简单的空间注意力设计是否能够在密集预测任务中与最先进的骨干网络(如 Swin、PVT)抗衡甚至超越?
- RQ2条件位置编码与全局子采样注意力策略是否在可比的 FLOPs 下提升性能?
- RQ3将局部与全局注意力交错(SSSA)是否是对复杂的移动窗口机制的有效且易于部署的替代方案?
- RQ4提出的 Twins 骨干在图像分类、语义/实例分割和目标检测数据集上的表现如何?
主要发现
- Twins-PCPVT-S 比 PVT-small 高 1.4%,并以 18% 的 FLOPs 达到 Swin-T 的性能。
- Twins-SVT-S 在 FLOPs 约少 35% 的情况下超越 Swin-T。
- Twins-SVT-S 在 Semantic FPN/ADE20K 设置中比 Swin-T 高 1.7% mIoU;Twins-SVT-L 超过 Swin-B 0.7% mIoU。
- Twins-PCPVT-S 在 ADE20K 上比 PVT-Small 提升 +4.5% mIoU,并比 ResNet-50 高出 7.6% mIoU;Twins-PCPVT-B/L 同样优于各自的 PVT 对应版本。
- Twins-SVT-S 与 Twins-SVT-B 在 COCO 目标检测与实例分割任务中,在 1x 和 3x 调度下的性能可与 Swin 变体相当或更好。
- 用 CPVT 替换 Swin-T 的相对 PE 并未提升检测性能,表明提升来自 Twins-SVT 设计本身,而非仅由位置编码带来的改进。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。