---
title: 'Winsor-CAM: Tunable Visual Explanations for CNNs'
url: https://www.emergentmind.com/topics/winsor-cam
type: topic
---

# Winsor-CAM: Tunable Visual Explanations for CNNs

Winsor-CAM is a human-tunable, post-hoc visual explanation method for convolutional neural networks (CNNs) designed to address the limitations of conventional Gradient-weighted Class Activation Mapping (Grad-CAM) methods. By employing layer-wise Winsorization—a percentile-based clipping strategy—Winsor-CAM produces saliency maps that robustly aggregate information across all convolutional layers while suppressing outlier attributions. A single percentile parameter enables semantic-level control over the granularity of the explanations, facilitating detailed, trustworthy model introspection without altering network architectures [2507.10846].

## 1. Motivation and Conceptual Framework

Grad-CAM, the standard technique for generating class-specific heatmaps, is typically restricted to the final convolutional layer of a CNN. This focus on deep layers captures only high-level semantic concepts but ignores low-level cues such as edges and textures. Furthermore, final-layer activations can be unreliable when the gradients are unstable. Uniform averaging of Grad-CAM outputs from all convolutional layers, a naïve extension, leads to the amplification of noisy or irrelevant signals and dilution of strong, semantically meaningful activations. Winsor-CAM overcomes these deficiencies by combining the following principles:

- Aggregation of saliency information across all convolutional layers.
- Winsorization to attenuate extreme (outlier) layer importances.
- Human tunability via a percentile parameter that controls semantic scale.

## 2. Layer-Wise Grad-CAM Formulation

Let a CNN have $n$ convolutional layers $i=1,\ldots,n$ with feature maps $A^{i} \in \mathbb{R}^{C_i \times H_i \times W_i}$. For target class $c$, the logit is $y^c$. The spatial gradient of the logit with respect to activation $A_k^i(u,v)$ is:
$$
G^c_{i,k}(u,v) = \frac{\partial y^c}{\partial A^i_k(u,v)}
$$
The channel-wise weights are computed as:
$$
\alpha^c_{i,k} = \frac{1}{H_i W_i} \sum_{u,v} G^c_{i,k}(u,v)
$$
The Grad-CAM map for layer $i$ is then:
$$
L^c_{\mathrm{GradCAM},i}(u,v) = \mathrm{ReLU} \left(\sum_{k=1}^{C_i} \alpha^c_{i,k} A^i_k(u,v)\right)
$$

## 3. Winsorization and Layer Importance Scoring

Layer importances $\Gamma^c_i$ are scalars summarizing each layer’s contribution, using one of two aggregations:
- **Mean**:
$$
\Gamma^c_i = \mathrm{ReLU}\left(\frac{1}{C_i} \sum_{k=1}^{C_i} \alpha^c_{i,k}\right)
$$
- **Max**:
$$
\Gamma^c_i = \mathrm{ReLU}\left(\max_{k} \alpha^c_{i,k}\right)
$$
Let $\Gamma^+$ be the set of $\Gamma^c_i > 0$. Given percentile $p\in[0,100]$, Winsor-CAM clips all positive $\Gamma^c_i$ at threshold $T = \mathrm{Quantile}(\Gamma^+,p)$:
$$
\Gamma^c_{i,\mathrm{winsor}} =
\begin{cases}
\min(\Gamma^c_i, T), & \Gamma^c_i > 0 \\
0, & \Gamma^c_i \leq 0
\end{cases}
$$
This mechanism controls the influence of outlier layers, preventing domination by layers with excessively large gradient values—a phenomenon frequently observed in deep networks.

## 4. Cross-Layer Aggregation and Final Saliency Map

Clipped importances are min–max normalized to $[L,H]$ (by default $L=0.1, H=1.0$):
$$
\tilde{\Gamma}^c_i =
\begin{cases}
L + \frac{\Gamma^c_{i,\mathrm{winsor}} - x_{\min}}{x_{\max} - x_{\min}} (H-L), & \Gamma^c_{i,\mathrm{winsor}} > 0 \\
0, & \text{otherwise}
\end{cases}
$$
Each $L^c_{\mathrm{GradCAM},i}$ is upsampled to a common spatial size $(H,W)$. The final Winsor-CAM heatmap is a weighted sum:
$$
\mathcal{W}^c_{\mathrm{WinsorCAM}}(u,v) = \sum_{i=1}^n \tilde{\Gamma}^c_i \, \mathcal{W}^c_i(u,v)
$$
Maps can be normalized to $[0,1]$ and overlaid on input images for visualization.

## 5. Tunable Semantic Control via Percentile Parameter \(p\)

The parameter $p$ provides interpretable, human-in-the-loop scaling of semantic granularity:
- **$p=0$ (uniform aggregation)**: All nonzero layers get equal weight; fine-grained, low-semantic visualizations result.
- **Intermediate $p$ (e.g., $p=20$–$60$)**: Balances suppression of outliers, enabling multi-scale, interpretable heatmaps.
- **$p=100$ (no clipping)**: Deep layers dominate; output approximates final-layer Grad-CAM.
Empirical evaluations indicate optimal mean Intersection-over-Union (IoU) and center-of-mass (CoM) alignment metrics typically occur for intermediate $p$ values.

## 6. Algorithmic Workflow

The Winsor-CAM procedure accepts an input image $I$, target class $c$, CNN $f$, the user’s Winsor parameter $p$, aggregation method (mean or max), and interpolation function. The workflow is:

1. Forward $I$ through $f$, saving all convolutional feature maps.
2. Backpropagate to compute $\frac{\partial y^c}{\partial A_k^i(u,v)}$.
3. For each layer: compute $\alpha^c_{i,k}$, produce $L^c_{\mathrm{GradCAM},i}$, upsample with chosen interpolation, and determine $\Gamma^c_i$.
4. Winsorize and normalize $\Gamma^c_i$ to obtain $\tilde{\Gamma}^c_i$.
5. Aggregate the reweighted layer maps to obtain $\mathcal{W}^c_{\mathrm{WinsorCAM}}$.

The method is post-hoc, requiring no architectural modifications, and is compatible with any pretrained CNN.

## 7. Empirical Evaluation and Comparative Results

Winsor-CAM was evaluated on PASCAL VOC 2012 for single-class localization using 933 training and 928 test images on multiple backbones (ResNet50, DenseNet121, InceptionV3, VGG16) [2507.10846]. Quantitative metrics include mean IoU and mean CoM distance. Table 1 illustrates performance for DenseNet121:

| Method      | IoU            | CoM Dist. (px)   |
|-------------|----------------|------------------|
| Winsor-CAM  | 0.469 ± 0.186  | 23.055 ± 16.379  |
| Grad-CAM    | 0.390 ± 0.173  | 25.684 ± 17.460  |
| Grad-CAM++  | 0.368 ± 0.180  | 24.929 ± 15.609  |
| LayerCAM    | 0.379 ± 0.174  | 24.331 ± 15.265  |
| ShapleyCAM  | 0.377 ± 0.173  | 26.765 ± 17.528  |

Across architectures, Winsor-CAM improved IoU by 5–10 points and reduced CoM error by 2–10 pixels over standard Grad-CAM. Naïve averaging of layer saliency maps resulted in coarse, often semantically uninformative heatmaps and inflated CoM error (e.g., ~86 px for ResNet50).

Variation of $p$ yielded small, consistent performance gains toward midrange values. For example, on DenseNet121:

| $p$ | IoU           | CoM Dist.      |
|-----|--------------|----------------|
| 0   | 0.441 ± 0.182| 22.78 ± 16.32  |
| 50  | 0.444 ± 0.184| 22.48 ± 16.03  |
| 100 | 0.443 ± 0.185| 21.99 ± 15.51  |

## 8. Qualitative Effects and Advantages

Adjustment of $p$ modulates the semantic focus of the generated maps. Low $p$ settings highlight details such as edges and textures by weighting early layers, midrange $p$ settings produce crisp object regions, and high $p$ values yield holistic masks akin to standard Grad-CAM. This enables practitioners to explore model focus across semantic hierarchies. Winsor-CAM achieves:

- Multi-scale semantic representation through cross-layer integration.
- Robustness to attribution outliers via Winsorization.
- Human-in-the-loop explanatory control with interpretable, continuous tuning.
- Full model compatibility as a post-hoc interpretability scheme.

Winsor-CAM advances interpretable AI by delivering layer-aggregated, robust, and tunably semantic visual explanations, outperforming single-layer and naïve multi-layer Grad-CAM variants in both interpretability and quantitative localization metrics [2507.10846].

Source: https://www.emergentmind.com/topics/winsor-cam