Grad-CAM (Gradient-weighted Class Activation Mapping) is a visual explanation technique that produces a coarse localization map highlighting the important regions in an image — using the gradients flowing into the last convolutional layer to weight the activation maps by their importance for the target class.
How Grad-CAM Works
- Gradients: Compute gradients of the target class score with respect to feature maps of the last conv layer.
- Weights: Global average pool the gradients to get importance weights $alpha_k$ for each feature map $k$.
- CAM: $L_{Grad-CAM} = ReLU(sum_k alpha_k A_k)$ — weighted sum of feature maps, ReLU keeps only positive influence.
- Upsampling: Upsample the CAM to input image resolution for overlay visualization.
Why It Matters
- Model-Agnostic: Works with any CNN architecture that has convolutional layers.
- Class-Discriminative: Different target classes produce different heat maps — shows what the model looks for per class.
- No Retraining: Post-hoc technique — no modification to the model architecture or training.
Grad-CAM is seeing what the CNN sees — highlighting the image regions that most influenced the classification decision.
gradcamexplainable ai
Explore 500+ Semiconductor & AI Topics
From EUV lithography to CUDA optimization — search the full knowledge base or chat with our AI assistant.