Two numbers,
one model
The same weights look perfect or badly miscalibrated, depending on which images you test them on.
The leakage trap
The easiest way to make a medical model look good is to test it on data it has already seen.
The model card says the final weights were “retrained on all cleaned images from the original train, test, and validation folders” and that “it has no independent test evaluation.” So the 624-image Kermany test folder, the benchmark most tutorials report, is training data for this model. We scored it anyway, to show how misleading that number would be.
Kermany images are all from children aged one to five at a single hospital. We could not find a second pediatric pneumonia set with a compatible licence in time, so our external tests use adult radiographs. That measures generalisation and population shift together, and we report it that way.
Near-0 or near-1 outputs on unfamiliar adult images show overconfidence, not certainty. The model card itself warns that softmax outputs are not calibrated probabilities.
Move the threshold
The shipped threshold is 0.5. Because outputs pile up near 1, useful thresholds sit extremely close to 1. Every number below is recomputed live from per-image scores.
Is a score of 0.9 really 90%?
A calibrated model’s scores of 0.9 come true about 90% of the time. Bins below show how often RSNA images in each score band actually had lung opacity.
Most images land in the top bin, where the model claims near certainty and is right far less often. Treat the score as a ranking, not a probability.
Can the heatmaps be trusted?
Two checks. First, Montgomery radiographs come with radiologist-drawn lung masks, so we measure Grad-CAM mass inside the lungs against the lungs’ share of the image. Second, a randomisation test checks that the maps depend on the learned weights at all.
Robustness to edits that shouldn’t matter
Does your browser run the same model?
This site runs the network on your device with ONNX Runtime Web, reading the original weights from Hugging Face. We checked it against the PyTorch pipeline used for every number on this page.
What this evaluation cannot tell you
- No in-distribution test exists. Every Kermany image was used to train the final weights. We can't measure pediatric performance honestly with this checkpoint.
- External cohorts are adults. Poor specificity on RSNA, Montgomery and Shenzhen mixes population shift (children → adults) with genuine generalisation error. We can't separate them.
- Labels differ. RSNA “Lung Opacity” is a bounding-box finding suggestive of pneumonia, not a confirmed diagnosis. Montgomery and Shenzhen labels are for tuberculosis, so their normals are the cleanest negatives we have.
- Samples are modest. 200 per RSNA class, 138 Montgomery and 100 Shenzhen images. Confidence intervals are shown and are wide.
- Thresholds chosen on these images are optimistic. The specificity-targeted thresholds above were picked on the same 400 RSNA images they are reported on.
- Grad-CAM is one view. It summarises one layer at 10×10 resolution. Passing the randomisation test shows the maps depend on the weights, not that they capture the model’s full reasoning.
- Nothing here is clinical validation. This is a teaching instrument for reading model behaviour critically.