Abstract

We propose a technique for producing ‘visual explanations’ for decisions from a large class of Convolutional Neural Network (CNN)-based models, making them more transparent. Our approach – Gradient-weighted Class Activation Mapping (Grad-CAM), uses the gradients of any target concept (say logits for ‘dog’ or even a caption), flowing into the final convolutional layer to produce a coarse localization map highlighting the important regions in the image for predicting the concept. Unlike previous approaches, GradCAM is applicable to a wide variety of CNN model-families: (1) CNNs with fully-connected layers (e.g. VGG), (2) CNNs used for structured outputs (e.g. captioning), (3) CNNs used in tasks with multi-modal inputs (e.g. visual question answering) or reinforcement learning, without architectural changes or re-training. We combine Grad-CAM with existing fine-grained visualizations to create a high-resolution class-discriminative visualization, Guided Grad-CAM, and apply it to image classification, image captioning, and visual question answering (VQA) models, including ResNet-based architectures. In the context of image classification models, our visualizations (a) lend insights into failure modes of these models (showing that seemingly unreasonable predictions have reasonable explanations), (b) outperform previous methods on the ILSVRC-15 weakly-supervised localization task, (c) are more faithful to the underlying model, and (d) help achieve model generalization by identifying dataset bias. For image captioning and VQA, our visualizations show even non-attention based models can localize inputs. Finally, we design and conduct human studies to measure if Grad-CAM explanations help users establish appropriate trust in predictions from deep networks and show that Grad-CAM helps untrained users successfully discern a ‘stronger’ deep network from a ‘weaker’ one even when both make identical predictions. Our code is available at https: //github.com/ramprs/grad-cam/ along with a demo on CloudCV [2] 1 and video at youtu.be/COjUB9Izk6E.


우리는 CNN 모델이 결정하는 가장 큰 클래스를 시각적으로 설명하는 기술을 제안한다.

Grad-CAM은 이미지에서 어떠한 클래스를 예측할 때 중요한 지역을 지역화 맵으로 강조하는 것을 생성하기 위해 마지막 컨볼루션 층에서 흐르는 해당 타겟 클래스가 가지는 그래디언트를 사용한다.

이전 연구와는 다르게 Grad-CAM은 CNN 모델에서 매우 잘 동작한다. (1) fcn이 포함된 VGG와 같은 CNN 모델 (2) captioning과 같은 구조적 아웃풋이 요구되는 CNN (3) 재학습이나 어떠한 구조적 변화가 포함되지 않는 visual Q&A와 같은 multi-modal input을 요구하는 CNN 또는 강화학습

우리는 Grad-CAM에 기존 시각화 방법과 결합하여 고해상도 클래스 시각화 기법인 Guided Grad-CAM을 만들었고, 이를 ResNet 기반의 아키텍쳐를 포함한 VQG 모델, 이미지 캡셔닝, 이미지 분류에 적용해보았다.

이미지 분류문제에서 제안한 시각화는 (a) 비합리적인 예측에는 그만한 이유가 따른다는 것을 제공하여 모델을 설명할 수 있게 하고 (b) 이전 방법보다 우수하며 (c) 기본 모델에서 잘 동작하며 (d) 데이터셋의 편향을 식별하여 모델 일반화를 돕는다. 

이미지 캡셔닝과 VQA에서는 non-attention 모델에서도 입력을 지역화할 수 있음을 보여준다. 마지막으로 만약 Grad-CAM의 설명이 깊은 신경망에서의 예측이 적절한 신뢰를 구성할 수 있도록 사용자를 돕거나, Grad-CAM이 훈련되지 않은 사용자가 동일한 예측을 할 때 강한 깊은 신경망의 기능을 약한 깊은 신경망에서 성공적으로 식별할 수 있도록 도와주는 연구를 수행합니다.


요약

  • CAM(Class Activation Map)을 확인하는 이유는 모델이 문제를 얼마나 잘 해결하고 있는가를 확인하는 지표가 될 수 있기 때문이다.
  • 강한 신겸망은 사람의 결정이 더 나아질 수 있도록 도와줄 수 있는 모델이고, 약한 신경망은 식별을 실패하는 모델이다.
  • 기존 CAM은 GAP가 존재하지 않으면 사용할 수 없는 문제가 있기 때문에 다양한 CNN 모델에 사용하기 어려웠다.

  •  모델이 해당 클래스를 나타내기 위해서는 특정 클래스를 나타낼 때 클래스에 특징맵이 변화하는 비율을 구하고, 이를 다시 특징맵에 곱해주어 얼마나 영향을 끼치는지를 측정한다.

 

  • 해당 논문에서는 다양한 실험을 진행해서 보여주고 있다. 대표적으로 Grad-CAM을 통해 데이터셋의 편향을 체크할 수 있으며, 이미지에서 어떤 클래스를 선택했을 때 그게 왜 아닌지를 또한 체크해볼 수 있다.

Reference

Selvaraju, R. R., Cogswell, M., Das, A., Vedantam, R., Parikh, D., & Batra, D. (2017). Grad-cam: Visual explanations from deep networks via gradient-based localization. In Proceedings of the IEEE International Conference on Computer Vision (pp. 618-626).
https://www.youtube.com/watch?v=faGsrPX1yFM&list=PLWKf9beHi3Tg50UoyTe6rIm20sVQOH1br&index=53