Gradient-weighted Class Activation Mapping

Description

Grad-CAM creates visual heatmaps showing which regions of an image a convolutional neural network focuses on when making a specific classification. Unlike pixel-level techniques, Grad-CAM produces coarser region-based explanations by using gradients from the predicted class to weight the CNN's final feature maps, then projecting these weighted activations back to create an overlay on the original image. This provides intuitive visual explanations of where the model is 'looking' for evidence of different classes.

Example Use Cases

Explainability

Validating that a melanoma detection model focuses on the actual skin lesion rather than surrounding healthy skin, medical equipment, or artifacts when making cancer/benign classifications.

Debugging an autonomous vehicle's traffic sign recognition system by visualising whether the model correctly focuses on the sign itself rather than background objects, shadows, or irrelevant visual elements.

Fairness

Auditing a medical imaging system for racial bias by examining whether diagnostic predictions inappropriately focus on skin tone regions rather than actual pathological features, ensuring equitable healthcare AI deployment.

Limitations

  • Requires access to the CNN's internal feature maps and gradients, limiting use to white-box scenarios.
  • Resolution is constrained by the final convolutional layer's feature map size, producing coarser localisation than pixel-level methods.
  • Only applicable to CNN architectures with clearly defined convolutional layers, not suitable for other neural network types.
  • May highlight regions that correlate with the class but aren't causally important for the model's decision-making process.

Resources

jacobgil/pytorch-grad-cam
Software Package
Grad-CAM: Visualize class activation maps with Keras, TensorFlow ...
Tutorial
kazuto1011/grad-cam-pytorch
Software Package
A Tutorial on Explainable Image Classification for Dementia Stages Using Convolutional Neural Network and Gradient-weighted Class Activation Mapping
DocumentationKevin Kam Fung Yuen
A Guide to Grad-CAM in Deep Learning - Analytics Vidhya
Tutorial

Tags

Data Requirements:
Data Type:
Evidence Type:
Expertise Needed:
Explanatory Scope:
Lifecycle Stage:
Technique Type: