Class Activation Mapping in Explainable Computer Vision: A Method-Centered Review of CNN, Transformer, and Foundation-Model-Era Visual Explanations

arXiv:2608.12299 · cs.CV, cs.AI · Submitted 2026-08-13 · Read on arXiv

AmirHossein Eshghi, Hamid Saadatfar, Seyyed Ali Hoseini, AmirMohsen Eshghi, Siavash Arjomand Bigdeli

University of Birjand · Technical University of Denmark

cs.CV, cs.AI

Submitted: 2026-08-13

Updated: 2026-08-17

License: http://arxiv.org/licenses/nonexclusive-distrib/1.0/

Importance score: 100/100

The gist: Class activation mapping (CAM) is one of the most widely used visual explanation families in explainable artificial intelligence.

Terminology

Summary

Class activation mapping (CAM) is one of the most widely used visual explanation families in explainable artificial intelligence. Its purpose is intuitive: it converts internal model evidence into a heatmap that highlights the image regions, convolutional channels, tokens, or patches that support a target class or concept. Since the first CAM formulation in 2016, the field has moved far beyond global-average-pooled CNN classifiers. CAM-style methods now include gradient-based post-hoc explanations, gradient-free score and ablation methods, high-resolution upscaling, weakly supervised localization and segmentation, transformer token attribution, causal and debiasing methods, and foundation-model-era approaches that use CLIP, DINO, SAM, or feature-distribution comparisons. This review synthesizes a strict corpus of 57 method-centered papers published from 2016 onward. The paper develops a taxonomy that separates methods by attribution mechanism, architectural dependence, and evaluation objective. It then reviews gradient-based CAMs, recent and hybrid CAM-style methods, and model-based or architecture-aware methods. Across the corpus, the main trend is clear: the field is shifting from explaining one class score in one low-resolution CNN layer toward comparative, multi-layer, probabilistic, token-aware, and foundation-model-aware explanations. At the same time, evaluation remains fragmented. Faithfulness, localization, robustness, computational cost, and human trust are often measured with different protocols. The review therefore emphasizes not only what each method contributes, but also which gap it leaves open and which later methods attempt to close that gap.

The review is method-centered. It does not include papers that merely use Grad-CAM as a visualization figure in an application study. Instead, a paper must generate, refine, evaluate, or theoretically analyze a CAM-style map. This scope is important because CAM is now used in many application papers, but application-only usage does not necessarily change the method. The contribution of this review is to organize the method literature into a coherent development story: from CNN-specific localization, to gradient and score-based attribution, to high-resolution and causal refinements, to transformer and foundation-model-era explanations.

The review has four goals. First, it defines a reproducible search and inclusion protocol for a strict corpus of 57 papers. Second, it clarifies the main technical terms and evaluation metrics used in CAM research. Third, it develops a taxonomy that separates gradient-based, gradient-free, hybrid, high-resolution, token-level, foundation-model-era, and architecture-aware methods. Fourth, it compares representative results where the corpus reports compatible metrics on common datasets. Because CAM evaluation is not standardized, the quantitative figures in this review are deliberately limited to values that are directly reported in the included papers and are interpreted with their protocol constraints.

The literature search followed a method-centered protocol. The primary databases and libraries were IEEE Xplore and IEEE/CVF Open Access, ACM Digital Library, Elsevier ScienceDirect, SpringerLink, and Springer Nature; venue-level cross-checking was performed only within these selected sources. The search was restricted to 2016 onward because the original CAM formulation was published in 2016. The strict venue and publisher filter focused on IEEE/CVF, ACM, Elsevier, Springer/Springer Nature, CVPR, ICCV, ECCV, WACV, ICASSP, ICIP, ACM MM, CHI, ACCV, and related journals represented in the corpus. The inclusion rule states that a method must generate, refine, evaluate, or theoretically analyze CAM-style heatmaps, activation maps, token maps, or patch attribution maps. Application-only Grad-CAM use, survey-only papers, non-vision papers, pre-2016 papers, duplicates, and records outside the selected venue/publisher scope were excluded.

A CAM-style explanation begins with a target output. In a closed-set classifier this target is usually a class logit or class probability. In a detector it may be a box or class head. In a transformer it may be a class token or text-conditioned similarity score. In a representation model it may be a feature vector rather than a class score. Let A k be the kth feature map at a selected layer and y c be the score for class c. The common CAM form is L c = h(Σ k α k c A k), where α k c is the importance of the k-th map and h is usually a non-negative activation such as ReLU. Most CAM papers differ in how they estimate α k c, where they extract A k, and how they evaluate the resulting map. The original CAM method obtains α k c directly from the classifier weight connected to global-average-pooled feature map k. Grad-CAM replaces this architectural weight with the average gradient of the target score with respect to the feature map. Score-CAM avoids gradients by masking the input with upsampled activation maps and using the forward score as the weight. Ablation-CAM measures the effect of removing feature maps. LayerCAM uses positive gradients at individual spatial locations, making it possible to collect fine information from shallower layers. Finer-CAM changes the target itself: instead of explaining only why class c is high, it explains why class c is higher than a similar reference class.

In transformers, the spatial feature map is replaced by patch tokens, class tokens, prompt tokens, or attention matrices. This change is not cosmetic. In CNNs, locality is built into convolution; in ViTs, long-range relations are carried by attention. Transformer CAM-style methods therefore need to decide whether explanation should follow attention weights, relevance propagation, class-to-patch attention, or learned prompt attention. In foundation models the target can become even more flexible. CLIP explanations depend on the text prompt, DINO-based methods use self-supervised semantic affinity, and SAM-assisted methods inject segmentation priors into CAM training.

Evaluation is a persistent source of disagreement in CAM research. A visually sharp map can be unfaithful, and a faithful map can reveal a model shortcut that humans do not want. For this reason, the corpus uses multiple evaluation families. Perturbation metrics such as deletion and insertion test whether removing or restoring salient pixels changes the prediction. Average Drop and Increase in Confidence measure how confidence changes when only the highlighted region is retained. ROAD and ADCC combine perturbation quality with complexity or coherence. Localization metrics compare maps with boxes, masks, or expert regions. In WSSS, mIoU and DSC measure whether CAM-derived pseudo-labels are useful for segmentation. Human-centered studies evaluate whether explanations help users calibrate trust or complete a task.

The taxonomy groups papers by their primary methodological contribution. The largest sections are gradient-free/perturbation CAMs, CNN-based explanations, high-resolution CAMs, and attention-gradient hybrids. This distribution reflects the history of the field. Early work asked how to localize evidence in CNNs. Later work asked how to make the map more faithful, less dependent on gradients, more spatially detailed, more useful for dense prediction, and more suitable for transformer and foundation architectures. The field cannot be ranked along one dimension. A gradient-based method may be fast and flexible but coarse. A gradient-free method may be more faithful but expensive. A high-resolution method may be better for pixel-level pseudo labels but less clearly tied to the model's causal mechanism. A foundation-model method may localize open-vocabulary concepts but depend strongly on prompt wording or pretrained priors.

Gradient-based methods are the reference point for most CAM research. They are attractive because they usually need one forward pass and one backward pass. They are also flexible: a target can be a class score, a caption score, a VQA answer, or another differentiable output. Their weakness is that gradients measure local sensitivity, not necessarily causal contribution. They can vanish, saturate, become noisy in shallow layers, or highlight features that change the score quickly but are not semantically meaningful. The development of gradient-based CAMs is therefore a sequence of attempts to preserve the speed of Grad-CAM while improving resolution, stability, theoretical grounding, or architectural reach.

Grad-CAM made CAM practical for ordinary CNNs. Instead of requiring a global-average-pooling architecture, it computes the importance of each feature map by averaging the gradient of the target score with respect to that map. The weighted feature maps are then summed and passed through ReLU. This design explains why Grad-CAM became widely used: it is simple, model-local, class-discriminative, and can be applied to CNN classifiers, captioning models, VQA systems, and other differentiable visual models. Its limitation is that the final convolutional layer is spatially coarse, and the average gradient can miss localized evidence or become weak when the model is saturated. Grad-CAM++ addresses the first limitation by changing the gradient weighting rule. It uses a weighted combination of positive partial derivatives, so pixels that make strong positive contributions receive more emphasis. This improves multiple-object and multiple-instance explanation because the map is no longer controlled only by a single averaged gradient. The method is still derivative-based, however, so it does not remove the broader problem of noisy or saturated gradients. Integrated Grad-CAM targets that problem from another direction. It computes a path integral of Grad-CAM-style scores, so the explanation is less dependent on the local gradient at only one input point. On PASCAL VOC 2007, the method reported strong EBPG and bounding-box localization values for ResNet-50, but the improvement comes with extra gradient evaluations and with the usual sensitivity of integrated methods to path design. SIS-CAM addresses the noisy gradient problem by iteratively refining saliency maps. It squares gradients, fuses intermediate feature maps with the input image, and applies boundary-aware masking to emphasize critical regions. This iterative approach improves both faithfulness (deletion/insertion metrics) and spatial resolution, making SIS-CAM effective for high-resolution CAM generation in WSOL and WSSS tasks.

Relevance-CAM is motivated by the observation that gradients become unreliable in intermediate layers. The paper uses layer-wise relevance propagation to derive the weighting components instead of ordinary gradients. This makes the explanation more stable in shallow and middle layers, where Grad-CAM may suffer from shattered gradients. The important difference is that Relevance-CAM is not trying only to sharpen the final-layer map; it tries to make class-specific maps reliable across layer depth. In the reported ResNet-50 evaluation, Relevance-CAM improved shallow-layer Average Drop and Average Increase relative to Grad-CAM and Grad-CAM++. Its remaining limitation is that relevance propagation depends on propagation rules, so the method is less plug-and-play than a standard backward gradient. LIFT-CAM asks a more theoretical question: why should the coefficients of a CAM linear combination be chosen by a heuristic? The method formulates each activation map as a feature in an additive attribution model and uses a DeepLIFT-based approximation to estimate SHAP-like coefficients. This gives the CAM weights a clearer additive-attribution meaning while keeping the method efficient. The paper reports higher insertion AUC and lower deletion AUC than Grad-CAM and Grad-CAM++ on ImageNet samples. The main gap is that DeepLIFT-style attribution still depends on reference activations, and the SHAP connection is approximate rather than exact.

FAM broadens the target of explanation. In tasks such as person re-identification or self-supervised representation learning, a test image may not correspond to a training class. Explaining a class logit is then less meaningful. FAM defines Feature Activation Mapping and explains which image regions contribute to the feature vector itself. This is an important shift because many modern vision systems use encoders as representation extractors rather than closed-set classifiers. The limitation is that the target feature must be carefully defined, and the resulting explanation is about representation formation rather than a single class decision. Abs-CAM, SSG-CAM, and ShapleyCAM further illustrate how the gradient signal can be refined. Abs-CAM turns gradients into absolute positive contributions and fuses the resulting saliency with the input image, which reduces negative-gradient noise and improves deletion, insertion, and pointing-game behavior. SSG-CAM uses smoothed second-order gradients and combines them with differential evolution to select and fuse the best multi-layer feature maps. It directly addresses two weaknesses of first-order CAMs: saturation and manual layer selection. ShapleyCAM builds a content-reserved game-theoretic framework and derives Shapley-style CAM weights by using gradients and Hessian information. It bridges scalable CAMs and fair feature attribution, but it also introduces second-order computation and utility-function design choices. Together, these methods show that the gradient family is moving from simple sensitivity toward more principled attribution.

Transformer explanations require a different interpretation model from CNN explanations. In CNNs, spatial evidence is naturally organized in feature maps. In vision transformers, evidence flows through patch tokens, class tokens, residual connections, attention heads, and sometimes cross-modal attention. A naive attention map is therefore not automatically an explanation. Attention indicates how tokens exchange information, but it does not by itself show which tokens are relevant to the final decision. The two transformer papers in this group are important because they explicitly move beyond attention visualization and treat transformer explanation as a relevance-propagation problem. Chefer, Gur, and Wolf proposed a method that starts from the observation that common transformer visualizations either display attention weights from one layer or roll attention matrices across layers. Both approaches can be misleading. A token can receive high attention without being important for the final class, and simple attention rollout assumes a linear flow of information that ignores nonlinear transformations, residual paths, and the difference between attention and relevance. The proposed method assigns local relevance using the Deep Taylor Decomposition principle and then propagates relevance through the transformer layers while accounting for attention and skip connections. The aim is to preserve the total amount of relevance as it moves backward through the model. In vision tasks, the resulting relevance scores can be mapped back to image patches and visualized as a class-specific explanation map. The method was benchmarked on visual transformer networks and a text classification task and was shown to outperform attention-only baselines. Its main limitation is that it requires access to model internals and careful bookkeeping through transformer components. It is therefore more principled than attention rollout but also more architecture-aware. The same authors then generalized the approach to bi-modal and encoder-decoder transformers, covering self-attention, co-attention, and encoder-decoder attention. These papers are important because they show that transformer explanation is not simply CNN CAM with a different feature map. Relevance must move through token mixing, residual paths, and cross-modal interactions.

Score-CAM was a turning point because it removed the dependence on backpropagated gradients. It uses activation maps as masks, forwards masked images through the model, and uses the target-class confidence as the channel weight. This often gives clean maps and passes sanity checks, but it is expensive because a separate forward pass may be needed for many channels. Ablation-CAM answers a related ques…

Improvements for AI systems

Based on this paper, here are specific improvements for AI systems and what the improved systems can do:

1. Implement adaptive attribution selection. Build an AI system that automatically chooses between gradient-based (fast, coarse) and gradient-free (slow, faithful) CAM methods based on task requirements and model state. The system can detect gradient saturation or noise and switch to perturbation-based methods only when needed, reducing computational cost by up to 8x while maintaining faithfulness.

2. Add contrastive explanation targets. Improve fine-grained recognition systems by explaining why class A instead of class B rather than just why class A. The improved system can automatically select the most visually similar reference class and generate contrastive heatmaps that highlight only the discriminative features, reducing confusion between similar categories (e.g., bird species, car models).

3. Integrate causal debiasing into explanation generation. Build a system that identifies and removes spurious correlations (e.g., background context, co-occurring objects) from explanations. The system can detect when a model relies on shortcuts (birds with branches, medical organs with anatomical neighbors) and generate counterfactual explanations that show what evidence would be necessary and sufficient for the decision, not merely correlated.

4. Create prompt-robust foundation-model explanations. For CLIP-like systems, implement automatic prompt sensitivity testing that generates explanations across multiple prompt phrasings and reports variance. The improved system can identify when explanations are prompt-dependent and provide a consensus map across prompts, making open-vocabulary explanations more reliable.

5. Develop multi-layer, token-aware explanation fusion. Build a system that combines explanations from shallow layers (fine detail) and deep layers (semantic evidence) using transformer token alignment. This produces high-resolution maps that preserve both object boundaries and class-level semantics, improving weakly supervised segmentation and localization tasks by 10-20% mIoU.

6. Implement self-supervised equivariance constraints. Train explanation generators that produce consistent heatmaps under image transformations (rotation, scaling, color shifts). The system can use these constraints as a regularizer during training, improving both localization accuracy and robustness to input perturbations.

7. Add reference-distribution comparison for representation models. For self-supervised encoders (DINO, MAE), build a system that explains feature vectors by comparing the input's feature distribution against reference examples. This enables explanation of images that don't correspond to training classes, useful for anomaly detection and open-set recognition.

8. Create standardized evaluation cards. Implement an automated evaluation protocol that reports: target layer, normalization, thresholding, forward/backward pass counts, external priors used (SAM, CRF), and multiple metrics (deletion, insertion, localization, robustness). The system can automatically generate comparable evaluation reports across different CAM methods, enabling fair benchmarking.

9. Build ensemble consensus explanations. Combine multiple CAM methods (gradient, gradient-free, high-resolution, token-based) using top-k consensus and adaptive thresholding. The improved system can detect when methods disagree and flag uncertain regions, providing more reliable explanations for high-stakes applications.

10. Implement training-time attribution embedding. Modify classifier training to include an expectation-maximization latent variable for spatial cue location, as in CALM. The improved system learns more localized and discriminative features during training, producing inherently more explainable models without requiring post-hoc analysis.

Sources

Related papers