HomeAI & Machine LearningGrad-CAM: Where a Medical-Scan AI Is Looking (2D)

Grad-CAM: Where a Medical-Scan AI Is Looking (2D)

Interactive 2D Class Activation Mapping simulator: a real, hand-specified convolutional network classifies a synthetic medical scan as Normal or Abnormal, and a genuine gradient-weighted class activation map (Grad-CAM) shows exactly which pixels drove that decision, laid out flat as input, heatmap and feature-map panels.

AI & Machine Learning2DAdvanced60 FPS📱 Mobile-adapted⇄ 3D version
2d-medical-imaging-ai ↗ Open standalone

This 2D companion to the 3D Grad-CAM simulator runs the exact same kind of real, hand-specified two-layer convolutional network — actual 3×3 convolutions, ReLU, max-pooling, global average pooling and a linear head — over a synthetic scan containing a movable, adjustable-contrast lesion, then computes a genuine Class Activation Map: the gradient-weighted sum of the final convolutional layer's feature maps that reduces, for a global-average-pooled linear head, to the exact formula used in real Grad-CAM interpretability tooling. Along the way it fixes a real calibration bug found by numerically testing the 3D source: that sim's deep "lesion-selective" channel was wired to a blob/Laplacian filter that saturates on the background's high-frequency texture instead of the lesion, so its predicted class barely moved as contrast increased. Here the same channel is wired to a blur/local-brightness filter instead — verified to make the classifier's Normal/Abnormal call genuinely track the lesion — while the CAM math, panel layout and every other control stay faithful to the original two-layer architecture.

⚙ Under the hood

Interactive 2D companion to the 3D Grad-CAM simulator: a real two-layer convolutional network classifies a synthetic medical scan as Normal or Abnormal on flat heatmap panels, computing a genuine Class Activation Map, and fixes a calibration bug found in the 3D source where the lesion-selective channel saturated on background texture instead of tracking the lesion.

Grad-CAMexplainable AImedical imagingCNNinterpretability2D

2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)