CAM (Class Activation Mapping) is a method that shows, as a heatmap computed from the feature maps of the last convolutional layer and the weights of the fully connected layer, "which parts of the image an image-classification CNN relied on when deciding on a class". Zhou et al. proposed it in 2016.
CAM applies to CNNs in which the last convolutional layer is followed only by global average pooling (GAP) and a single fully connected layer. In this architecture, the class score is "the feature maps summed with the weights of the fully connected layer", so summing the feature maps with the same weights reveals how much each location in the image contributed to the score.
The computation is only one forward pass and a weighted sum of the feature maps. No backpropagation is needed. Because each class has different weights, different locations light up for "dome" and "palace" even in the same image.
The key finding of CAM is that a CNN trained only with the class labels attached to images can also indicate object locations fairly accurately. Without ever using ground-truth bounding boxes around objects, it achieved an error rate on ImageNet object localization close to that of AlexNet, which was trained with bounding boxes. Locating objects without location labels in this way is called weakly supervised object localization.

