Property | Data |
---|---|
Created | 2023-02-23 |
Updated | 2023-02-24 |
Author | @YiTing, @Aiden |
Tags | #study |
Title | Venue | Year | Code |
---|---|---|---|
Swin Transformer: Hierarchical Vision Transformer using Shifted Windows | ICCV | '21 | ✓ |
Swin Transformer
, that capably serves as a general-purpose backbone for computer vision.
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
- The high resolution of pixels in images compared to words in text.
This paper propose a hierarchical Transformer
whose representation is computed with Shifted windows
To address these differences.
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. The hierarchical design
and the shifted window approach
also prove beneficial for all-MLP architectures.
Property | Definition |
---|---|
A linear embedding layer is applied on this raw-valued feature to project it to an arbitrary dimension (denoted as |
A key design element of Swin Transformer is its shift of the window partition between consecutive(連續的) self-attention layers.
Earlier
sliding window based self-attention
approaches suffer from low latency on general hardware due to diffrent key
sets for different query
pixels, therefore, Swin-T let all query patches within a window share the same key
set, which facilitates memroy access in hardware. The experiments show that the proposed shifted window
has the followning advantages when compared with sliding windows
:
- much lower latency
- yet is similar in modeling power
- Proven beneficial for all-MLP architectures
An issue with shifted window partitioning is that it will result in more windows, and some of the windows will be smaller than
So, this paper proposed a method name Efficient Batch Computition Approach
cyclic-shifting
toward thetop-left
direction. After the shift, abatched window
may be composed of several sub-windows that are not adjacent(鄰近的) in the feature map.- Therefore, we have to use
masking mechanism
to limitself-attention computation
to within eachsub-window
- Therefore, we have to use
- A batched
window
can be composed of severalsub-windows
, i.e: