One Size Doesn't Fit All: Input Adaptive Class Activation Mapping for Improved Visual Explanations

Ayesha Sahar, Tahir Mustafa Madni, Tehseen Zia, David Windridge, Uzair Iqbal Janjua, Waleed Umar

It’s late, your eyes are heavy, and you’ve spent the day wrestling with "black box" models that refuse to tell you why they classified that blurry blob as a "Norwich Terrier." You aren't alone. In the world of Explainable AI (XAI), we’ve been using the same set of tools for years, but a new paper suggests we’ve been making a fundamental mistake: treating every image the same way.

TL;DR

Most AI "explanation" tools use fixed settings for every image, which often results in blurry or noisy visual heatmaps. ADAPT-CAM changes the game by tuning its own parameters on the fly for every single image and model architecture, using math inspired by biological vision to produce much sharper and more faithful explanations.

What Problem Does This Paper Address?

We rely on techniques like Class Activation Mapping (CAM) to generate heatmaps that show us which pixels a model focused on. However, existing CAM methods are often "one-size-fits-all." They use the same weighting logic and channel selection criteria whether they are looking at a high-contrast photo of a dog or a subtle, low-contrast medical X-ray.

This rigidity leads to two main issues:

  1. Noise: The heatmaps often highlight irrelevant background clutter.
  2. Imprecision: The "focus" area is often a giant, blurry blob that doesn't tell you if the model looked at the dog's ears or just the grass it was standing on.

The authors argue that because every image has a different distribution of features, the explanation tool itself needs to be input-adaptive.

Methods

ADAPT-CAM introduces a pipeline that calculates its own "hyperparameters" for every image it processes. It’s built on three clever pillars:

  1. Curvature-Modulated Weighting: Most tools only look at the gradient (how much the score changes if a feature changes). ADAPT-CAM also looks at the curvature (how fast that change is accelerating). If a channel has high curvature, it’s considered "unstable" and its influence is dialed down.
  2. Adaptive Local Contrast Normalization (LCN): Inspired by how human neurons process visual context, this step enhances local details. Crucially, the "neighborhood size" for this contrast check isn't fixed; it’s calculated based on how spread out the model's activations are for that specific image.
  3. Knee-Guided Soft Selection: Instead of just picking the "Top 10" most important channels (which can be arbitrary), ADAPT-CAM uses "knee-point detection"—a mathematical way to find the point of diminishing returns. It then uses a smooth "exponential decay" to fade out less important channels rather than cutting them off abruptly.
Figure 1: Overview of the proposed parameter-adaptive CAM method

Datasets

The researchers validated their approach using:

  • ImageNet: The massive, standard benchmark for general image classification.
  • Oxford 102 Flowers: A "fine-grained" dataset where the differences between classes (like two very similar species of lilies) are tiny, making precise explanations much harder to achieve.

They tested these across both classic CNNs (like ResNet-50) and modern Vision Transformers (like DINOv2).

Key Insights and Ideas

  • Biological Mimicry Works: By incorporating "center-surround" logic (similar to how our eyes highlight edges and contrast), the heatmaps become much more intuitive to human viewers.
  • The "One Size" Myth: The authors proved that the "optimal" settings for an explanation tool shift significantly between a CNN and a Transformer. By letting the tool adapt, they bypassed the need to manually tune it for different architectures.
  • Soft Selection > Hard Pruning: Fading out weak signals rather than deleting them preserves the "context" of the image, leading to more stable and less "jittery" explanations.

Key Results

The math bears out the visual improvements. Using metrics like Average Drop (which measures how much the model's confidence falls when you remove the "important" parts) and Average Increase:

  • Superior Faithfulness: On DenseNet-121, ADAPT-CAM achieved an Average Drop of just 16.7%, nearly half that of the popular Grad-CAM++ (~38.8%). A lower drop means the tool is much better at identifying the actual pixels the model cares about.
  • Visual Precision: Qualitatively, ADAPT-CAM "shrink-wraps" objects. While other methods might highlight a whole bird and the branch it's sitting on, ADAPT-CAM tends to focus tightly on the bird itself, ignoring the irrelevant background.

Limitations and Future Work

While ADAPT-CAM is a leap forward, it isn't perfect:

  • Complexity: Because it calculates parameters per image, it requires an extra backward pass through the network. It’s still fast, but slightly more "expensive" than the simplest methods.
  • Transformer "Clutter": While it works on Vision Transformers, the authors noted that in extremely cluttered scenes, the Transformer's global attention can still result in fragmented responses.
  • Next Steps: The authors are looking toward medical imaging, where the "input-adaptive" nature of this tool could be a literal lifesaver by precisely highlighting tiny anomalies that fixed-parameter tools might blur over.

Summary updated

Abstract

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.
BibTeX
@misc{sahar2026one,
  author = {Ayesha Sahar and Tahir Mustafa Madni and Tehseen Zia and David Windridge and Uzair Iqbal Janjua and Waleed Umar},
  title = {{One Size Doesn't Fit All: Input Adaptive Class Activation Mapping for Improved Visual Explanations}},
  year = {2026},
  eprint = {2611.29993},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.29993},
}
Figure