일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
- coding test
- keras
- 백준
- 시계열 분석
- 머신러닝
- xai
- 코딩 테스트
- meta-learning
- python
- Unsupervised learning
- 딥러닝
- cs231n
- Class activation map
- SmoothGrad
- 설명가능한 인공지능
- 기계학습
- 인공지능
- Interpretability
- Cam
- Artificial Intelligence
- grad-cam
- 설명가능한
- Deep learning
- GAN
- Score-CAM
- 코딩테스트
- AI
- 메타러닝
- Explainable AI
- Machine Learning
- Today
- Total
iMTE
Grad-CAM Guided Channel-spatial Attention Module for Fine-grained Visual Classification 내용 정리 [XAI-13] 본문
Grad-CAM Guided Channel-spatial Attention Module for Fine-grained Visual Classification 내용 정리 [XAI-13]
Wonju Seo 2021. 6. 21. 14:33논문 제목 : Grad-CAM Guided Channel-spatial Attention Module for Fine-grained Visual Classification
논문 주소 : https://arxiv.org/abs/2101.09666
Grad-CAM guided channel-spatial attention module for fine-grained visual classification
Fine-grained visual classification (FGVC) is becoming an important research field, due to its wide applications and the rapid development of computer vision technologies. The current state-of-the-art (SOTA) methods in the FGVC usually employ attention mech
arxiv.org
주요 내용 정리 :
1) 최근 연구들을 찾아보는 도중 Grad-CAM을 사용해서 fine-grained visual classification (FGVC)의 성능 향상시킨 짧은 연구가 있어서 소개하려고 한다. 이 연구의 핵심은 기존 channel-spatial attention에 Grad-CAM을 사용해서 좀 더 object의 class discritive 한 부분을 보는 것을 목적으로 하였다. 논문을 읽어보면 저자는 attention 방법이 background와 같은 중요하지 않은 부분을 볼 수 도 있기에, 이를 해결하기 위해서 Grad-CAM을 쓴 것으로 보인다. 중요한 것은 Grad-CAM을 사용해서 attention을 주기보다 Grad-CAM에서 획득된 weights을 attention weights과 비슷하게 함으로써 attention mechanism에서 만들어지는 map이 Grad-CAM에서 만들어지는 CAM과 비슷하게 만들어지게 하였다.
2) 밑의 그림을 보면, 기존의 channel-spatial attention module에 따로 Grad-CAM을 추가해서 attention을 guide하는 것을 보여준다.

밑의 그림이 좀 더 specific하게 어떻게 Grad-CAM guided channel-spatial attention module을 만드는 지 보여주고 있다.

위 식에서 Fcp는 convolution 연산들과 pooling operation, A=[a1,a2,...,aC]∈RC×W×H는 feature map 을 의미한다.
(1) 먼저, global average pooling인 Fcg를 통과시켜 획득된 값에서 두개의 fully connected layers (softmax function 포함) Fcr를 통과시켜 각 channel의 weights을 구한다 S=[s1,s2,...,SC]∈RC.
(2) 다음으로 feature map A를 S로 re-scaling 한다. 이는 Weighted feature map B를 얻는 과정을 의미한다. B=[b1,b2,...bC]∈RC×W×H.
(3) 다음으로, channel-wise summation과 2D softmax function을 포함하는 Ffa를 통과시킨 다음, B의 featuremaps이 channel dimension으로 flatten되어, spatial attention weights T∈RW×H를 획득한다.
(4) 마지막으로, channel-spatial attention-wegited feature map D=[d1,d2,...dC]∈RC×W×H로 획득한다.
이때, ⊙은 Hadamard product이고, T는 다음과 같다.
이렇게 획득된 D에 대해서 classification이 진행된다. Ftc는 multiple FC classifier로 classificaiton을 담당한다.
3) 위에서 channel-spatial attention module이 완성되었으니, Grad-CAM을 추가해야한다. Grad-CAM에서 각 featurea map k의 importance는 다음과 같이 표현된다.
이제 이렇게 얻은 β를 갖고, attention module에서 획득된 S와의 KL divergence로 새로운 loss를 정의한다.
위 식에서 ˜βk는 β에 sigmoid를 취한 형태이고, (즉, ˜βkc=sigmoid(βkc)), KL은 KL divergence를 의미한다.
마지막으로, original cross-entropy loss를 추가하여 최종 loss를 획득한다.
4) 먼저, numerical performance를 확인해보면, 저자들이 제안한 방법이 SOTA보다 더 좋은 성능을 두 데이터 셋에서 보임을 알 수 있다.

추가적으로, spatial attention, channel attention, GGAM-Loss를 각각 제거하였을 때, 혹은 모두 사용할 때의 성능 차이를 확인해본 결과, 모든 방법을 사용할 때 가장 좋은 성능을 보였다.

Visual performance 평가를 위해 baseline, channel attention, spatial attention, channel-spatial attention에 GGAM-loss를 적용시킨 경우와 적용시키지 않은 경우의 Grad-CAM을 비교하였다. GGAM-Loss를 적용시킬 때, 좀 더 정확하게 물체 주변에 heatmap이 형성되는 것을 확인할 수 있다.
(Object localization만 생각한다면 channel attention + GGAM-Loss와 channel-spatial attention w/o GGAM-Loss가 좋은 성능을 보인 것 같은데, FGVC 문제 상, high order features를 추출하는 것이 더 나은 방법임으로, 제안된 방법이 부리 주변에서 high importance를 가진 것은 저자가 제안한 의도를 성취했다고 볼 수 있다.)

마지막으로, λ 값을 바꿨을 때의 성능 차이를 확인해본 결과, GGAM-Loss를 사용하지 않는 경우보다는 성능이 좋아지는 것을 확인 할 수 있었다.

+
Channel attention, spatial attention이 어떻게 module화가 되는 지 간단히 확인 할 수 있었고, Grad-CAM의 방법을 그대로 사용해서 CAM을 형성한다음에 다시 attention을 넣는 방법을 사용하지 않고, Loss를 추가해서 attention 을 guide 했다는 점에서 매우 유용한 접근 방법이라고 생각이 든다.