【ICCV21】Swin Transformer: Hierarchical Vision Transformer using Shifted Windows

文章介绍了一种新的视觉Transformer模型——SwinTransformer,它通过分层结构和移位窗口机制,解决了视觉领域中实体尺度变化和高分辨率像素的问题,表现出在图像分类、对象检测和语义分割等任务上的优秀性能,超越了先前的state-of-the-art。
摘要由CSDN通过智能技术生成

在这里插入图片描述

论文链接: https://openaccess.thecvf.com/content/ICCV2021/papers/Liu_Swin_Transformer_Hierarchical_Vision_Transformer_Using_Shifted_Windows_ICCV_2021_paper.pdf

Article Reading Sharing

0. Abstract

This paper presents a new vision Transformer, called Swin Transformer, that capably serves as a general-purpose backbone for computer vision.
本文提出了一种新的视觉变压器,称为Swin变压器,它可以作为计算机视觉的通用骨干

Challenges in adapting Transformer from language to vision arise from differences between the two domains, such as large variations in the scale of visual entities and the high resolution of pixels in images compared to words in text.
将Transformer从语言应用到视觉的挑战来自于这两个领域之间的差异,例如视觉实体规模的巨大差异以及与文本中的单词相比,图像中像素的高分辨率。

To address these differences, we propose a hierarchical Transformer whose representation is computed with Shifted windows.
为了解决这些差异,我们提出了一个分层的Transformer,它的表示是用移位窗口计算的。

The shifted windowing scheme brings greater efficiency by limiting self-attention computation to non-overlapping local windows while also allowing for cross-window connection.
移位窗口方案将自关注计算限制在不重叠的局部窗口,同时允许跨窗口连接,从而提高了效率。

This hierarchical architecture has the flexibility to model at various scales and has linear computational complexity with respect to image size.
这种层次结构具有在各种尺度上建模的灵活性,并且相对于图像大小具有线性计算复杂度。

These qualities of Swin Transformer make it compatible with a broad range of vision tasks, including image classification (87.3 top-1 accuracy on ImageNet-1K) and dense prediction tasks such as object detection (58.7 box AP and 51.1 mask AP on COCO testdev) and semantic segmentation (53.5 mloU on ADE20K val).
Swin Transformer的这些特性使其与广泛的视觉任务兼容,包括图像分类(ImageNet-1K上的87.3 top-1精度)和密集预测任务,如对象检测(COCO testdev上的58.7 box AP和51.1 mask AP)和语义分割(ADE20K val上的53.5 mIoU)。

Its performance surpasses the previous state-of-theart by a large margin of +2.7 box AP and +2.6 mask AP on COCO, and +3.2 mloU on ADE20K, demonstrating the potential of Transformer-based models as vision backbones.
其性能在COCO上大幅超过了+2.7 box AP和+2.6 mask AP,在ADE20K上超过了+ 3.2 mloU,显示了基于transformer的模型作为视觉骨干的潜力。

The hierarchical design and the shifted window approach also prove beneficial for all-MLP architectures.
分层设计和移位窗口方法也被证明对所有MLP体系结构都是有益的。


capably serves as a general-purpose(通用) backbone for computer vision.

such as large variations (变化) in the scale of visual entities (实体) and the high resolution of pixels
in images compared to words in text

a hierarchical (分层) Transformer whose representation is computed with Shifted windows.

scheme(计划)brings greater efficiency by limiting self-attention computation to non-overlapping local
windows while also allowing for cross-window connection.

These qualities of Swin Transformer make it compatible with a broad range of vision tasks

dense (密集) prediction tasks such as object detection (58.7 box AP and 51.1 mask AP on COCO test-dev) and semantic segmentation (53.5 mIoU on ADE20K val)

surpasses (超过) the previous state-of-the-art by a large margin of +2.7 box AP and +2.6 mask AP on
COCO, and +3.2 mIoU on ADE20K, demonstrating (展示) the potential of Transformer-based models as vision backbones.


代码仓库:https://github.com/microsoft/Swin-Transformer

1. Introduction

本文旨在扩展transformer为计算机视觉的通用backbone,与CNN形成竞争,以提高其在图像分类和视觉语言模型任务上的表现。

Swin Transformer适合作为各种视觉任务的通用主干,与以前基于Transformer的架构形成鲜明对比。


has long been dominated(主导)by convolutional neural networks (CNNs).

在这里插入图片描述
Figure 1. (a) The proposed Swin Transformer builds hierarchical feature maps by merging (合并) image patches (shown in gray) in deeper layers and has linear computation complexity to input image size due to computation of self-attention only within each local window (shown in red). It can thus (因此) serve as a general-purpose backbone for both image classification and dense recognition tasks. (b) In contrast, previous vision Transformers [19] produce feature maps of a single low resolution and have quadratic (二次) computation complexity to input image size due to computation of self-attention globally.

the prevalent (普遍的)architecture today is instead the Transformer

Designed for sequence modeling and transduction tasks, the Transformer is notable (值得注意)for its use
of attention to model long-range dependencies(依赖) in the data.

demonstrated promising (有前途) results on certain tasks

between the two modalities(模式)

can vary substantially(大幅) in scale

this would be intractable(难以对付) for Transformer on high-resolution images

would be intractable(棘手的) for Transformer on high-resolution images, as the computational complexity of its self-attention is quadratic(二次)

conveniently leverage (利用)advanced techniques for dense prediction such as feature pyramid networks (FPN) [38] or U-Net [47]. The linear computational complexity is achieved by computing self-attention locally within non-overlapping(重叠) windows that partition an
image (outlined in red).

between consecutive (连续) self-attention layers, as illustrated in Figure 2.

strategy is also efficient in regards to real-world latency(延迟): all query patches within a window share the same key set, which facilitates(促进) memory access in hardware.

在这里插入图片描述
a unified(统一) architecture across computer vision and natural language processing could benefit both fields, since it would facilitate (促进) joint modeling of visual and textual signals and the modeling knowledge from
both domains can be more deeply shared.

2. Related Work

  • CNN and variants

  • Self-attention based backbone architectures

  • Self-attention/Transformers to complement(补充)CNNs

  • Transformer based vision backbones

本篇工作与Vision Transformer(ViT)非常相关

Our approach is both efficient and effective, achieving state-of-the-art accuracy on both COCO object detection and ADE20K semantic segmentation.

3. Method

3.1 Overall Architecture

It first splits an input RGB image into non-overlapping(非重叠) patches by a patch splitting(分裂) module, like ViT

Each patch is treated as a “token” and its feature is set as a concatenation(连接)of the raw pixel RGB values

project it to an arbitrary(任意) dimension

Several Transformer blocks with modified(修改)self-attention computation (Swin Transformer blocks) are applied on these patch tokens.

is reduced by patch merging(合并) layers as the network
gets deeper

The first patch merging layer concatenates(连接) the
features of

Swin Transformer blocks are applied afterwards(后来) for feature transformation

在这里插入图片描述
two successive(连续) Swin Transformer Blocks

with regular and shifted windowing configurations(配置), respectively.

  • Swin Transformer block

Swin Transformer is built by replacing the standard multi-head self attention (MSA) module in a Transformer block by a module based on
shifted windows

3.2 Shifted Window based Self-Attention

  • Self-attention in non-overlapped windows

  • Shifted window partitioning in successive blocks

  • Efficient batch computation for shifted configuration

  • Relative position bias

3.3 Architecture Variants

除了构建的基础模型swin-B之外,还有swin-T、swin-S、和swin-L

在这里插入图片描述

4. Experiments

We conduct experiments on ImageNet-1K image classification [19], COCO object detection [43], and ADE20K semantic segmentation [83].
我们对ImageNet-1K图像分类[19]、COCO目标检测[43]、ADE20K 语义分割 [83]进行了实验。

In the following, we first compare the proposed Swin Transformer architecture with the previous state-of-the-arts on the three tasks.
在下文中,我们将首先比较所建议的Swin Transformer体系结构与之前关于这三个任务的最新技术

Then, we ablate the important design elements of Swin Transformer.
然后,对Swin变压器的重要设计要素进行了分析。

4.1 Image Classification on ImageNet-1K

在这里插入图片描述

4.2 Object Detection on COCO

在这里插入图片描述

4.3 Semantic Segmentation on ADE20K

在这里插入图片描述

FLOPS 注意全部大写 是floating point of per second的缩写,意指每秒浮点运算次数。用来衡量硬件的性能。
FLOPs 是floating point of operations的缩写,是浮点运算次数,可以用来衡量算法/模型复杂度。

4.4 Ablation Study

在这里插入图片描述
在这里插入图片描述

5. Conclusion

swin transformer 可以产生 层次特征表示 和 相对于输入图像的大小 具有线性计算复杂度,在COCO和ADE20K方面实现了SOTA。

本文提出的基于位移窗口的自注意力在视觉问题上是有效和高效的。

6. Acknowledgement

We thank many colleagues at Microsoft for their help, in particular, Li Dong and Furu Wei for useful discussions; Bin Xiao, Lu Yuan and Lei Zhang for help on datasets.

此部分不包含已有作者。

References

https://github.com/microsoft/Swin-Transformer

https://gitcode.com/microsoft/Swin-Transformer/overview

https://openaccess.thecvf.com/content/ICCV2021/papers/Liu_Swin_Transformer_Hierarchical_Vision_Transformer_Using_Shifted_Windows_ICCV_2021_paper.pdf

My thought

swin transformer 更强调在视觉任务语言任务上的通用性,本文更强调其在不同视觉任务上的backbone能力。

彩蛋

轻松一刻
在这里插入图片描述

欢迎在评论区讨论本文

Swin Transformer是一种基于Transformer模型的视觉领域网络,它在2021年由微软研究院发表在ICCV上的一篇文章中提出,并且获得了ICCV 2021最佳论文的荣誉称号。\[3\] Swin Transformer与之前的Vision Transformer有几个不同之处。首先,Swin Transformer使用了层次化构建方法,即在特征图尺寸中进行多次下采样,这有助于构建目标检测、实例分割等任务的backbone。而Vision Transformer在一开始就直接进行16倍的下采样,并且后续的特征图也保持这个下采样率不变。其次,Swin Transformer引入了Windows Multi-Head Self-Attention(W-MSA)的概念,将特征图划分成多个不相交的窗口,并且在每个窗口内进行Multi-Head Self-Attention操作。这样做可以减少计算量,特别是在浅层特征图很大的情况下。然而,这样做也会隔绝不同窗口之间的信息传递,因此作者提出了Shifted Windows Multi-Head Self-Attention(SW-MSA)的概念,通过此方法可以在相邻的窗口之间传递信息。\[2\] Swin Transformer在COCO数据集的目标检测和实例分割任务中表现出色,并且目前仍然是该任务中的第一名。\[3\] Swin Transformer的论文和官方开源代码可以在论文地址和代码地址中找到。\[1\] \[3\] #### 引用[.reference_title] - *1* *2* *3* [Swin-Transformer网络结构详解](https://blog.csdn.net/qq_37541097/article/details/121119988)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

猛码Memmat

欢迎支持,随缘打赏 ~

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值