Segmentation Transformer: Object-Contextual Representations for Semantic Segmentation

bolero2.dev
9 min readJul 10, 2023

--

(paper link : https://arxiv.org/pdf/1909.11065v6.pdf)

OCR이라는 모듈을 사용하면 성능을 올릴 수 있음을 나타낸 표. (papers with code 참조)

0. Abstract

Semantic Segmentation → 픽셀 위치에 Class Index가 매겨져 있다.

이는 곧, 픽셀과 Object Class의 연관성(=Context)을 찾으면 성능을 올릴 수 있음을 의미한다.

알고리즘은 다음과 같다:

  1. Semantic Segmentation 학습을 수행한다. = Object Region을 학습한다 → 자동차는 창문이 있고, 앞에 헤드라이트가 있고, 평평한 바닥 같은 것 위에 있다 등등…
  2. 객체 영역(ex. colormap)에 있는 실제 픽셀 값의 표현을 수집(aggregation) → “Object region representation” 을 학습할 수 있음.
  3. 각각의 Object 영역 ↔ 각 Pixel 간의 relation 을 계산한다. 각 픽셀의 representation을 수집, 해당 Object 별로 가중치를 다르게 준다(weighted).

0–1. HRNet

High-Resolution Network

ref : https://paperswithcode.com/method/hrnet

엄청 예전에 나온 모델. 고해상도 feature map을 network end-to-end 까지 끌고가는 모델이다.

Pose Estimation, Object Detection, Semantic/Instance Segmentation 각종 영역에서 사용되는 Backbone network 중 하나이다.

1. Introduction

OCR 모듈을 사용했을 때의 성능 향상 수준 그래프

기존에 Semantic Segmentation 에서 유명한 FCN 이후로 Deep Convolution Network가 Image Semantic Segmentation 영역에서 효과가 있음을 입증하여 지금까지 사용되고 있다.

또한, DeepLab Network는 ASPP(Atrous Spatial Pyramid Pooling) 모듈을 사용하여 Receptive Field 를 늘려 Object in Image의 Context를 파악하는 것이 중요하다는 것을 알렸다.

ref : https://towardsdatascience.com/review-deeplabv3-atrous-convolution-semantic-segmentation-6d818bfd1d74

맨 왼쪽은 일반적인 Convolution 연산(rate=1)인데, 이는 image 내에서 객체의 문맥적 특성을 파악하는 데 별 도움이 되지 않기 때문에 중간/오른쪽 처럼 padding을 줌으로써, receptive field 를 넓혀 contextual feature를 파악할 수 있다.

빨간 지점이 포커싱하고자 하는 부분.

만약 일반적인 dillation convolution(= atrous convolution) 이라면 왼쪽 이미지처럼 빨간색-살색 혹은 빨간색-파란색 관계에서 문맥적 특성을 파악하게 된다.

하지만 OCR(Object-Contextual Representation) 기법으로는 Object 내의 Pixel 을 Aggregation 하여 pixel-object 사이의 relation을 파악하게 된다.

2. Related Works

OCR 관련 연구로는 4개를 꼽을 수 있다.

  1. Multi-Scale Context
  2. Relational Context
  3. Coarse-to-fine Segmentation
  4. Region-wise Segmentation

2–1. Multi-Scale Context

  • PSPNet(Pyramid Scene Parsing Network) : 다양한 해상도의 Multi-scale feature map을 활용하여 기존의 눈에 안보이는/헷갈리는 영역을 잘 잡아냈었다 (CVPR, 2017)
  • DeepLab : 다양한 rate를 적용한 dilated Convolution을 활용하여 multi-scale feature map을 추출하였다.
  • Encoder-Decoder : multi-resolution feature 를 활용하여 multi-scale 에 대응하였다.

2–2. Relational Context

여기서 relation 은 similarity와 동치이다.

3. Approach

Semantic Segmentation은 이미지 내에서 하나의 픽셀 $P_i$ 이 $K$ 개의 Class 중 $K_n$ 번째 클래스에 매핑되는 것을 판별하는 문제이다.

3–1. Background

3–1–1. Multi-Scale Context

Dilation Convolution 관련 식이다.

  • $d$ : dilation convolution에서의 rate(12, 24, 36, …)
  • $t$ : convolution 연산에서의 position index
  • $y_{i}^{d}$ : rate=$d$ 일 때 $p_{i}$ 에 대한 output representation
  • $K_{t}^{d}$ : $t, d$ 에서의 Kernel parameter
  • $p_s$ : dilation convolution에서 $s$번째 sampled position

3–1–2. Relational Context

  • $\delta$, $\rho$ : 서로 다른 transform function (ex. self-attention)
  • $\Iota$ : pixel 값의 집합
  • $w_{is}$ : $x_i$ 와 $x_s$ 의 relation → $x_i$에서 추론되거나 또는 $x_i$ 와 $x_s$ 사이의 연산으로 도출된다.
  • $y_i$ : output

3–2. Formulation

pixel $p_i$에 대응하는 라벨 $l_i$는 pixel $p_i$ 의 object의 라벨이다 → OCR(Object-Contextual Representation)의 접근법

  1. structurize all the pixels in image $I$ into $K$ soft object regions
  2. represent each object region as $f_k$ by aggregating the representations of all the pixels in the $k$th object region
  3. augment the representation for each pixel by aggregating the $K$ object region representations with consideration of its relations with all the object regions

3–2–1. Soft Object Regions

$K$는 Class 개수를 의미한다. 즉, $K$ object region은 (example)Dog 가 있는 영역을 의미한다.

(OCR 자체가 이미지 내에서 전체적으로 Receptive field 넓혀서 문맥 파악하는 것이 아니라, Object 자체에 집중하기 때문임.)

이미지 $I$는 $K$개의 클래스로 이루어져 있으므로, $\{ M_1, M_2, M_3, … , M_k\}$ 로 이루어져 있다고 볼 수 있다.

$M_k$ 는 2D map 형태이며, coarse segmentation map 형태이다.

( coarse segmentation map : 정확하지 않은(not fine details) segmentation color map)*

이는 ResNet, HRNet 과 같은 Backbone network의 output 이며, CE Loss 를 통해 학습된다.

3–2–2. Object Region Representation

그러면, 위에서 Object Region에 대한 2D Map 정보를 알고 있으니, 이에 해당하는(=매칭되는) pixel 값을 알 수 있다.

이를 모아서(aggregate) 아래 식을 적용하여 representation을 도출한다.

3–3. Architecture

3–3–1. Backbone

dilated ResNet-101, HRNet-W48 사용

  • dilated ResNet-101 : stage 3과 4에 OCR 모듈을 붙임
  • HRNet-W48 : final layer 에 OCR 모듈을 붙임.

3–3–2. OCR Module

Linear function (1*1 conv → BN → ReLU) 사용.

4. Experiments

4–1. Datasets

본 논문에서는 다음과 같은 데이터셋을 타겟으로 하여 실험을 진행했다.

  • Cityscapes
  • ADE20K
  • LIP
  • PASCAL-Context
  • COCO-Stuff

Sign up to discover human stories that deepen your understanding of the world.

--

--

bolero2.dev
bolero2.dev

Written by bolero2.dev

ML/DL and CV Engineer & Researcher

No responses yet

Write a response