[论文解读] CSWin Transformer: A General Vision Transformer Backbone with Cross-Shaped Windows
CSWin Transformer 引入跨形窗口自注意力,具备并行横向与纵向条纹以及局部增强位置编码,构建可扩展的通用视觉骨干,在分类、检测和分割任务上具有强大性能。
We present CSWin Transformer, an efficient and effective Transformer-based backbone for general-purpose vision tasks. A challenging issue in Transformer design is that global self-attention is very expensive to compute whereas local self-attention often limits the field of interactions of each token. To address this issue, we develop the Cross-Shaped Window self-attention mechanism for computing self-attention in the horizontal and vertical stripes in parallel that form a cross-shaped window, with each stripe obtained by splitting the input feature into stripes of equal width. We provide a mathematical analysis of the effect of the stripe width and vary the stripe width for different layers of the Transformer network which achieves strong modeling capability while limiting the computation cost. We also introduce Locally-enhanced Positional Encoding (LePE), which handles the local positional information better than existing encoding schemes. LePE naturally supports arbitrary input resolutions, and is thus especially effective and friendly for downstream tasks. Incorporated with these designs and a hierarchical structure, CSWin Transformer demonstrates competitive performance on common vision tasks. Specifically, it achieves 85.4\% Top-1 accuracy on ImageNet-1K without any extra training data or label, 53.9 box AP and 46.4 mask AP on the COCO detection task, and 52.2 mIOU on the ADE20K semantic segmentation task, surpassing previous state-of-the-art Swin Transformer backbone by +1.2, +2.0, +1.4, and +2.0 respectively under the similar FLOPs setting. By further pretraining on the larger dataset ImageNet-21K, we achieve 87.5% Top-1 accuracy on ImageNet-1K and high segmentation performance on ADE20K with 55.7 mIoU. The code and models are available at https://github.com/microsoft/CSWin-Transformer.
研究动机与目标
- 开发一个具有改进的效率和长距离建模能力的通用视觉变换骨干。
- 提出一个跨形窗口自注意力机制,在水平方向和垂直方向的条纹中并行计算注意力。
- 引入 Locally-Enhanced Positional Encoding (LePE),以获得更好的局部位置偏置和输入分辨率灵活性。
- 构建分层的 CSWin Transformer 架构,并在 ImageNet-1K、COCO 和 ADE20K 上进行验证。
- 在相似 FLOPs 下展示相对于 Swin Transformer 的改进,并通过更大规模的预训练数据进行扩展。
提出的方法
- 定义 Cross-Shaped Window (CSWin) 自注意力,将多头分成两个并行组以实现水平和垂直条纹注意力。
- 在等宽 stripe sw 内计算注意力,条纹宽度随深度变化以在容量与成本之间取得平衡。
- 将头部分成两组,使水平与垂直注意力在一个块内并行运行而不产生额外计算。
- 引入 Locally-Enhanced Positional Encoding (LePE),作为自注意力的并行模块添加,作用于投影后的值并支持任意输入分辨率。
- 构建一个四阶段的分层 CSWin Transformer,具有重叠嵌入,并给出四个变体 CSWin-T/S/B/L,含有指定的通道数和头部配置。
- 在 ImageNet-1K 分类、COCO 目标检测/实例分割以及 ADE20K 语义分割上进行评估,包含和不包含 ImageNet-21K 预训练。
实验结果
研究问题
- RQ1CSWin 自注意力是否能够通过跨形窗口有效地实现更大的感受野且计算高效?
- RQ2并行的水平/垂直条纹注意力是否在不显著增加计算量的情况下提高了建模能力?
- RQ3LePE 在不同输入分辨率和下游任务中是否提供稳健的位置编码?
- RQ4与 Swin 及其他视觉 Transformer 相比,CSWin Transformer 作为通用骨干在分类、检测和分割任务中的表现如何?
主要发现
- CSWin-T 在 ImageNet-1K 上以 4.3G FLOPs 获得 82.7% Top-1,超越同等预算下的 Swin-T 和 DeiT-S。
- CSWin-S 与 CSWin-B 在使用可比较的 FLOPs 与模型规模时超过 Swin-S 与 Swin-B。
- 在 COCO 目标检测上,CSWin-B 实现 53.9box AP 与 46.4 mask AP,显著超过 Swin-B。
- 在 ADE20K 分割任务上,CSWin-B 达到 53.9 mIoU(某些设置为 52.2 mIoU),CSWin-L 在 ImageNet-21K 预训练下达到 55.7 mIoU,超越此前的 SOTA 骨干。
- 在 ImageNet-21K 预训练下,CSWin-B/L 在 ImageNet-1K 上分别达到 87.0/87.5 的 Top-1 准确率,显示出来自更大数据的收益。
更好的研究,从现在开始
从论文设计到论文写作,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。