Resource
GitHub - 920232796/SETR-pytorch: Implementation of SETR model, Original paper: Rethinking Semantic Segmentation from a Sequence-to-Sequence Perspective with Transformers.
Introduction
- CNN 기반 Semantic Segmentation
- 기존 방식은 대부분 FCN(Fully Convolution Network)의 Encoder-Decoder로 구성되어 있다.
- Encoder : Feature Representation Learning을 역할 하며, 주로 Stacked Conv. Layers로 구성되어 있다.
- Decoder : Pixel Level Classification 역할을 수행한다.
- Encoder에서 stacked convolution layers를 지남에 따라 얻어지는 feature map은 resolution은 감소하고 depth가 깊어짐에 따라, 점점 Spatial Information은 줄어들고, abstract한 정보를 학습하게 된다.
- 또한, 구조적인 관점에서 receptive field는 network의 depth에 선형적인 관계를 가진다. 따라서 넓은 receptive field를 갖도록 network를 구성하기 위해서 depth를 늘려야 하는데, 일정 depth 이상으로 layer를 추가 하는 것은 의미가 없다. 즉 receptive field가 구조적으로 제한이 있어 FCN은 long range context를 학습하기 어려운 문제가 있다.
- 이런 한계를 극복하고자 Atrous/Dilate Convolution 등 방법으로 receptive field를 늘리는 방법들을 사용하였지만, encoder-decoder 구조를 탈피하지 못하고, down-sampling 방식으로 인한 단점은 여전하다.

- SETR(“SE”mantic + “TR”ansformer)
- Encoder에 pure Transformer만을 사용한 모델을 제안.
- CNN 기반 모델과 다르게 pooling, stride와 같은 이미지/feature down-sampling 없이Transformer encoder를 이용하여 global context를 학습하는 새로운 접근 방법을 제안.
- Transformer 모델은 이미 NLP분야에서 성능을 입증하였고, ViT(Vision Transformer)를 통해 Image Classification에서 좋은 성능을 보였다. 이는 이미지 특징 추출을 위해 stacked convolution 구조를 통한 공간 정보는 압축(손해)하며 global context를 학습한다는 종래 방식이 필수가 아님을 증명하였다.
(Translation Equivariance + Locality를 Inductive Bais로 하는 Conv. 방식이 Image 분야의 가장 효율적이라는 기존 방법에서 탈피)
Contributions
- Transformer Encoder를 적용한 새로운 semantic segmentation 구조를 제안
(Encoder-Decoder -> Sequence to Sequence)
- 다양한 복잡도를 가진 Decoder를 적용하여 Self Attention의 특징 추출 효과에 대한 광범위한 해석 수행함.
- SOTA 성능 달성 (ADE20K: 50.28% mIoU Pascal Context: 55.83% mIoU)
Proposed Method
- SETR(”SE”gmentation + “TR”ansformers)
1. Sequentialization and Position Embedding
- Transformer 모델을 사용하기 위해 $H \times W \times 3$ resolution의 이미지를 $C$ hidden channel size를 가지는 $L$개의 sequential vector 형태로 re-representation 함.
- 본 논문에서는 ViT와 동일하게 입력 영상을 $16 \times 16$ 개의 patch로 분할한다. 각각의 patch를 flatten 한 후 linear projection하여 $C$차원으로 축소하여 결과 적으로 1차원 patch embedding의 sequence로 변환한다. (L X C, L = H/16 X W/16)