Skip to content
Last Dictionary

Grad-CAM

abbreviation/GRAD-kam/Also: gradient-weighted class activation mapping, Guided Grad-CAM, class activation mapping, CAM

In plain wordsA technique that shows, as a coarse heat map, which regions of an image a vision network relied on when choosing a particular label.

  1. Gradient-weighted Class Activation Mapping: a saliencysaliency map, n.: A heat map laid over an image or text that highlights which parts most influenced an AI model's output — or, in vision science, which parts of a scene would most catch a viewer's eye. method for convolutional networksconvolutional neural network, n.: A kind of neural network built for images and other grid-like data. It slides small pattern detectors across the input, finding edges first, then shapes, then whole objects. that highlights, at the resolution of the last convolutional layer, the image regions that support a chosen class. For a target class c, the gradient of its score with respect to each feature mapfeature map, n.: The grid of numbers produced when one learned pattern detector is scanned across an image, showing where, and how strongly, that pattern appears. A^k is averaged over spatial positions to give an importance weight; the map is the ReLUReLU, abbr.: The most common rule a neuron uses to produce its output: keep the number if it is positive, replace it with zero if it is negative. Simple, fast and surprisingly effective. of the weighted sum of the feature maps, upsampled to image size, so that only regions with positive influence on the class appear. Earlier class activation mapping (CAM) worked only for networks ending in global average pooling and had to retrain them; weighting feature maps by gradients removes both limits, so the method applies unchanged to most CNNs, including those inside image-captioning and visual question-answering systems. Combining the map elementwise with guided backpropagation (Guided Grad-CAM) adds pixel-level detail. Resolution is limited by the final feature grid, often 7 × 7 or 14 × 14.

    Grad-CAM showed the 'doctor' prediction resting on the stethoscope, not the person's face.

LGrad-CAMc=ReLU⁡(∑kαkcAk),αkc=1Z∑i∑j∂yc∂AijkL^{c}_{\text{Grad-CAM}} = \operatorname{ReLU}\Big(\sum_k \alpha^{c}_{k} A^{k}\Big), \qquad \alpha^{c}_{k} = \frac{1}{Z}\sum_{i}\sum_{j} \frac{\partial y^{c}}{\partial A^{k}_{ij}}

Origin

Introduced by Ramprasaath R. Selvaraju, Michael Cogswell, Abhishek Das, Ramakrishna Vedantam, Devi Parikh and Dhruv Batra in 'Grad-CAM: Visual Explanations from Deep Networks via Gradient-based Localization' (arXiv, October 2016; ICCV 2017). It extended class activation mapping by Bolei Zhou, Aditya Khosla, Agata Lapedriza, Aude Oliva and Antonio Torralba (CVPR 2016).

Usage note

A Grad-CAM map shows where evidence for a class lies, not what the network detected there. Variants such as Grad-CAM++ and Score-CAM change how feature maps are weighted; vision transformers need adaptations.

Related

See also
  • saliency mapsaliency map, n.: A heat map laid over an image or text that highlights which parts most influenced an AI model's output — or, in vision science, which parts of a scene would most catch a viewer's eye.
  • feature attributionfeature attribution, n.: Giving each input to an AI model — each pixel, word or data column — a score for how much it pushed a particular output up or down.
  • convolutional neural networkconvolutional neural network, n.: A kind of neural network built for images and other grid-like data. It slides small pattern detectors across the input, finding edges first, then shapes, then whole objects.
  • feature mapfeature map, n.: The grid of numbers produced when one learned pattern detector is scanned across an image, showing where, and how strongly, that pattern appears.
  • integrated gradientsintegrated gradients, n.: A way to score how much each input feature contributed to a neural network's output by gradually morphing a blank 'baseline' input into the real one and adding up the network's sensitivity along the way.
  • image classificationimage classification, n.: Teaching a computer to say what a picture shows by choosing a label, such as 'cat', 'pneumonia' or 'stop sign', from a fixed list of possibilities.

Sources

  1. Selvaraju, R. R. et al. (2017). Grad-CAM: Visual Explanations from Deep Networks via Gradient-based Localization. Proceedings of ICCV 2017.
  2. Zhou, B., Khosla, A., Lapedriza, A., Oliva, A. & Torralba, A. (2016). Learning Deep Features for Discriminative Localization. Proceedings of CVPR 2016.

Mentioned in

feature attributionfeature attribution, n.: Giving each input to an AI model — each pixel, word or data column — a score for how much it pushed a particular output up or down., post hoc explanationpost hoc explanation, n.: An explanation produced after a model has been built, by a separate tool that examines the finished model, rather than one that comes from a model designed to be understandable., saliency mapsaliency map, n.: A heat map laid over an image or text that highlights which parts most influenced an AI model's output — or, in vision science, which parts of a scene would most catch a viewer's eye., guided backpropagationguided backpropagation, n.: A way of producing sharp, detailed pictures of which parts of an image a vision network responded to, by passing only positive signals backward through the network., model-agnosticmodel-agnostic, adj.: Describes a method that works with any kind of AI model, because it only needs to feed the model inputs and observe its outputs, never to look inside., SmoothGradSmoothGrad, n.: A trick for making explanation heat maps less speckled: compute the map for many noisy copies of the input and average them, so random flicker cancels out.