One Size Doesn't Fit All: Input Adaptive Class Activation Mapping for Improved Visual Explanations
Authors: Ayesha Sahar, Tahir Mustafa Madni, Tehseen Zia, David Windridge, Uzair Iqbal Janjua, Waleed Umar
Organizations: Department of Computer Science, Air University, Pakistan · Department of Computer Science, COMSATS University Islamabad, Islamabad, Pakistan · Department of Computing, Middlesex University, London, U.K.
Despite their widespread use in tasks such as image classification, object detection and semantic segmentation, the limited interpretability of Convolutional Neural Networks (CNNs) and Vision Transformers (ViTs) can undermine trust and hinder adoption in safety-critical applications. Explainable artificial intelligence (XAI) methods seek to address this by providing human-understandable explanations for model predictions. Class Activation Maps (CAM) constitute one such widely used XAI technique for visualizing discriminative regions. However, existing CAM methods may exhibit limitations in channel weighting, localization, and adaptability across network architectures potentially resulting in noisy or imprecise explanations. To address these issues, we propose ADAPT-CAM, a gradient-based, parameter-adaptive CAM framework. The method combines first-order gradient energy with activation-weighted second-order curvature to derive channel contributions. It further incorporates adaptive local contrast normalization and knee-guided soft channel selection to refine the resulting explanations. Importantly, key parameters are estimated independently for each input, allowing the framework to adapt to variations in feature representations across network architectures. We validate ADAPT-CAM on ImageNet and Oxford 102 Flowers across CNN and ViT architectures. Quantitative results demonstrate competitive or superior performance against established CAM methods across multiple evaluation metrics. In parallel, qualitative comparisons illustrate its ability to highlight discriminative image regions. Further parameter analysis and ablation experiments examine the behaviour and contributions of the individual adaptive components. These findings demonstrate the applicability of ADAPT-CAM across different architectures and datasets.
Figures & tables
Figure 1: Overview of the proposed parameter-adaptive CAM method
Architecture
Method
Insertion ↑
Deletion ↓
Avg Drop (%) ↓
Avg Increase (%) ↑
DenseNet
Grad-CAM [ 18 ]
0.517 ± 0.0120
0.097 ± 0.0044
52.785 ± 1.8957
10.80 ± 1.39
Grad-CAM++ [ 19 ]
0.578 ± 0.0121
0.094 ± 0.0042
38.860 ± 1.8024
18.60 ± 1.74
Smooth Grad-CAM++ [ 20 ]
0.510 ± 0.0121
0.127 ± 0.0061
47.510 ± 1.6147
6.60 ± 1.11
XGrad-CAM [ 21 ]
0.444 ± 0.0131
0.184 ± 0.0082
59.005 ± 1.5634
3.60 ± 0.83
Score-CAM [ 23 ]
0.471 ± 0.0102
0.233 ± 0.0103
41.795 ± 0.9252
7.80 ± 1.20
EigenCAM [ 24 ]
0.526 ± 0.0136
0.092 ± 0.0051
48.967 ± 1.4472
3.10 ± 0.76
Table 1: Evaluation of ADAPT-CAM and baseline methods on ImageNet using DenseNet-121 and ResNet-50 (mean ± SEM over 500 images)
Architecture
Method
Insertion ↑
Deletion ↓
Avg Drop (%) ↓
Avg Increase (%) ↑
DINOv2
Grad-CAM [ 18 ]
0.786 ± 0.012
0.533 ± 0.015
13.220 ± 0.841
29.60 ± 2.04
Grad-CAM++ [ 19 ]
0.798 ± 0.013
0.520 ± 0.015
13.390 ± 0.868
25.55 ± 1.95
Score-CAM [ 23 ]
0.736 ± 0.014
0.357 ± 0.016
20.239 ± 1.233
22.87 ± 1.88
RISE [ 37 ]
0.758 ± 0.011
0.315 ± 0.015
17.671 ± 0.819
25.72 ± 1.95
Attention Rollout [ 38 ]
0.840 ± 0.012
0.319 ± 0.015
8.771 ± 0.728
27.90 ± 2.01
ViT-CX [ 39 ]
0.775 ± 0.014
0.451 ± 0.016
16.347 ± 1.191
26.07 ± 1.96
Table 2: Evaluation of ADAPT-CAM and baseline methods on ImageNet using DINOv2 and ViT-B/16 (mean ± SEM over 500 images)
Architecture
Method
Insertion ↑
Deletion ↓
Avg Drop (%) ↓
Avg Increase (%) ↑
ResNet-50
Grad-CAM [ 18 ]
0.5127 ± 0.0151
0.2594 ± 0.0054
32.97 ± 1.687
11.12 ± 1.41
Grad-CAM++ [ 19 ]
0.5391 ± 0.0130
0.2479 ± 0.0068
46.44 ± 1.898
14.80 ± 1.59
Smooth Grad-CAM++ [ 20 ]
0.5388 ± 0.0117
0.2647 ± 0.0067
47.46 ± 1.564
5.34 ± 1.01
XGrad-CAM [ 21 ]
0.4923 ± 0.0133
0.3181 ± 0.0059
62.62 ± 1.762
4.22 ± 0.90
Score-CAM [ 23 ]
0.5453 ± 0.0115
0.2260 ± 0.0059
38.44 ± 1.768
8.70 ± 1.26
EigenCAM [ 24 ]
0.5338 ± 0.0089
0.2880 ± 0.0057
31.33 ± 1.512
3.80 ± 0.86
Table 3: Evaluation of ADAPT-CAM and baseline methods on Oxford 102 Flowers using ResNet-50 and ViT-B/16 (mean ± SEM over 500 images)
Figure 2: Qualitative comparison on ImageNet [ 31 ] for DenseNet121 [ 33 ]
Figure 3: Qualitative comparison on ImageNet [ 31 ] for ViT-B/16 [ 36 ]
Figure 4: Qualitative comparison on Oxford 102 Flowers [ 32 ] for ResNet-50 [ 34 ]
Figure 5: Qualitative comparison on Oxford 102 Flowers [ 32 ] for ViT-B/16 [ 36 ]
Parameter
DenseNet-121 [ 33 ]
ResNet-50 [ 34 ]
ViT-B/16 [ 36 ]
DINOv2 [ 35 ]
p
0.7848 ± 0.0068
0.6777 ± 0.0889
0.3295 ± 0.0315
0.3998 ± 0.0186
λrel
0.1300 ± 0.4486
0.0018 ± 0.0052
0.0028 ± 0.0027
0.0417 ± 0.0244
Detected Knee Rank ( K )
57.66 ± 12.12
218.91 ± 75.58
316.43 ± 35.23
232.62 ± 32.13
Detected Knee Rank (%)
5.63 ± 1.18
10.69 ± 3.69
41.20 ± 4.59
30.29 ± 4.18
Adaptive LCN Window
6.10 ± 1.00
5.07 ± 0.84
9.10 ± 1.96
8.96 ± 1.90
Adaptive LCN Window (%)
87.14 ± 14.25
72.43 ± 11.94
65.00 ± 14.01
56.00 ± 11.89
Table 4: Cross-architecture comparison of image-adaptive parameters in ADAPT-CAM (mean ± SD over 200 randomly selected ImageNet images)
Configuration
Deletion AUC
Insertion AUC
Average Drop (%)
Average Increase (%)
A1: No λrel (Without Curvature)
0.1617
0.6244
17.48
34.16
A2: λrel=1
0.1280
0.6511
15.40
37.22
A3: p=1
0.1253
0.6637
12.57
39.91
A4: p=0.1
0.1420
0.6448
14.25
37.62
A5: No Channel Selection
0.1531
0.6356
16.16
35.50
A6: Hard Channel Selection
0.1338
0.6454
13.19
38.42
Table 5: Ablation study of ADAPT-CAM components and adaptive parameter settings