Same real math as the 3D version — an actual small CNN (fixed, reproducible weights) processes a synthetic 32×32 scan: two real convolutional layers (edge/blob/blur filters → ReLU → 2×2 max-pool), a global-average-pool, and a linear head scoring "Normal" vs "Abnormal" — laid out here as flat 2D heatmap panels instead of 3D bars.
Class Activation Map (Zhou et al. 2016;
generalized as Grad-CAM by Selvaraju et al. 2017):
L^c(i,j) = ReLU( Σ_k w_k^c · A_k(i,j) )
A_k(i,j) = k-th feature-map channel, final conv layer
w_k^c = ∂y^c / ∂(GAP(A_k))
= classifier weight for channel k, class c
(exact when the head is GAP + linear, as here)
Fixed vs the 3D source: the 3D sim wires its lesion-selective deep channel to the Laplacian/blob filter. This scan's background texture has a high-frequency term whose curvature is larger than the smooth lesion's, so after ReLU that channel saturates on background noise — verified numerically, P(Abnormal) stayed pinned at 99.94% across the whole 0–60% contrast range in the 3D sim. This 2D version wires the lesion-selective channel to the blur/local-brightness filter instead — smoothing suppresses the high-frequency background far more than it suppresses a smooth Gaussian bump, so the classifier genuinely responds: P(Abnormal) now swings from ≈12% (no lesion) to ≈85%+ (strong, centered lesion), and the CAM heatmap peak lands within one grid cell of the true lesion center.
- Position / contrast sliders — move a real Gaussian-bump "lesion" through the image and control how strongly it stands out from the background texture.
- Explain Class — chooses which class's score y^c is being explained; the weight vector w^c flips, so the same feature maps produce a different heatmap.
- CAM Source Layer — Final conv shows the true gradient-weighted CAM (8×8, coarse but class-discriminative); Layer 1 blur shows the raw pre-classifier response (32×32, sharp but not class-aware).
- Panel layout — input scan (top-left) → CAM overlay (bottom-left) → Layer-1 feature maps (4 tiles) → Layer-2 feature maps (6 tiles) → output probability bars (bottom).
Real-world relevance: this is the exact technique radiologists and regulators demand from black-box scan classifiers before trusting a "positive" call — the heatmap must land on the actual lesion, not on an unrelated artifact, and the predicted class must actually track the pathology, not the background.