A convolutional neural network trained with transfer learning (commonly a VGG16 backbone pre-trained on natural images, then fine-tuned on labelled chest X-rays) slides small filters across the image, building up layers of "feature maps" that go from simple edges to complex textures like the hazy white patches of pulmonary infiltrate seen in pneumonia. Each layer shrinks the spatial size while growing the number of channels, funnelling the image down to a single probability.
Grad-CAM (Selvaraju et al., 2017) doesn't require retraining a model — it re-uses gradients already computed during backpropagation, which is why it has become a standard way to audit medical imaging CNNs before they're trusted in a clinical pipeline.
Watch a synthetic chest X-ray funnel through the convolutional layers of a CNN toward a pneumonia probability, then check the model's Grad-CAM heatmap to see whether it's really looking at the infiltrate.
Stacked feature-map layers shrink spatially while growing in channel depth as they move from raw pixels to abstract patterns; the final probability is compared against a decision threshold that trades sensitivity against specificity.
Adjust infiltrate severity and which lung is affected, move the decision threshold, and toggle the Grad-CAM overlay. Run a forward pass to see activation pulse from the X-ray through the network to the output gauge.
Clinical screening CNNs are usually tuned to favour sensitivity over raw accuracy, because a missed pneumonia case is far costlier than a false alarm that a radiologist double-checks.