top of page

Gradient-weighted Class Activation Mapping (Grad-CAM)

Grad-CAM (Gradient-weighted Class Activation Mapping) is a technique for visualizing which parts of an input image were most important for a specific output class in a convolutional neural network (CNN). Grad-CAM produces a heatmap that highlights the regions of the image that were most relevant to the CNN's prediction.

 

The basic idea behind Grad-CAM is to use the gradients of the output class with respect to the feature maps of the last convolutional layer of the network to weight the feature maps. Specifically, the gradient information is used to compute a set of importance weights for each feature map, which are then used to produce the final heatmap.

Source: Understand Your Algorithm with Grad-CAM

To compute the importance weights, Grad-CAM first computes the gradients of the output class with respect to the feature maps of the last convolutional layer. The resulting gradient maps are then global-average-pooled to produce a set of importance weights, which are used to weight the feature maps. Finally, the weighted feature maps are summed to produce the final heatmap.

The resulting heatmap highlights the regions of the input image that were most relevant to the CNN's prediction, providing a visualization of the CNN's decision-making process. Grad-CAM has been used in a variety of applications, including image classification, object detection, and segmentation, and has been shown to be effective in identifying the regions of an input image that are most relevant to a CNN's prediction.

grad-cam.png

©2023 by XAIF. Proudly created with Wix.com

bottom of page