본문 바로가기
딥러닝(Machine Deep learning)

Attention Module

by Park Hyun Kook 2020. 7. 9.

Attention for extract essential feature map

-Attention Module Effectiveness: 아래 Figure 1 통해 attention 효과를 확인할 있다. BAM(Bottleneck Attention Module) 통해 추출된 attention map intermediate feature map에서 essential feature 강조하고, 불필요한 부분은 억제하는 것을 확인할 있다.

 

Figure 1: Effect of Attention  

 

Channel attention, Spatial attention, Channel & Spatial Attention

-Channel Attention: channel attention feature map channel간의 관계를 이용하여 특정 channel 강조(attention)한다. 구조는 아래 Figure 1 같다. 이를 식으로 표현하면 eq.1 같다.

  1. Input feature map global average pooling(GAP) 통해 channel size 벡터가 되며 값은 해당하는 channel 대표하게 된다.

  2. 이후 벡터는 번째 Fully Connected layer(fc1) 통해 유의미한 정보를 갖는 벡터로 압축되며, activation function σ1 (Leaky ReLU) 통해 비선형성을 가지게 된다.

  3. 다음 번째 Fully Connected layer(fc2) activation function σ2 (Sigmoid) 통해 압축된 벡터는 0-1 사이의 값을 갖는 channel size 강조(attention) 벡터로 만들어진다.

  4. Attention 벡터는 input feature map scaling하며 최종적으로 channel 강조된 feature map 만들어진다.

Figure 2: Architecture of Channel attention
Equation 1: Channel Attention

 

-Spatial Attention(Pixel Attention): 단일 층을 이용한 Spatial Attention input feature map 1x1 convolution layer 적용하여 pixel별로 channel information 취합하고, 1 channel attention feature map 만든다. 이후 강조된 feature map으로 input feature map scaling 하여 attention feature map 만들어진다. 이를 수식으로 표현하면 eq.2 같다.

Figure 3: Architecture of Spatial (Pixel) attention
Equation 2: Spatial Attention  

 

-Channel & Spatial Attention: CBAM block에서 제안된 channel attention spatial attention 모두 사용한다. Channel attention 먼저 수행하는 것이 성능이 우수했다.

 

Figure 3: Architecture of CBAM block, combination of Channel & Spatial attention

 

Reference:

1. https://arxiv.org/pdf/1807.06521.pdf

2. Attention 모델을 이용한 단일 영상 초고해상도 복원 기술-문환복, 윤상민

댓글