Technical writeup
CXR Triage Whitepaper
Predicting pneumonia-like patterns in chest X-rays for low-resource triage — a progression from a baseline CNN to transfer learning to medical foundation-model embeddings, ending in a deployed public inference API.
63%
Baseline CNN
76%
MobileNetV2
91%
MedSigLIP + LogReg
Contents
Abstract
CXR Triage is an educational healthcare-AI project for binary chest X-ray triage: NORMAL versus PNEUMONIA. It began as a learning exercise after an introductory deep-learning course, but was deliberately pushed beyond notebooks into a full product and deployment workflow.
Three model families were built and compared — a baseline CNN, a MobileNetV2 transfer-learning model, and a MedSigLIP embeddings + logistic-regression pipeline. The foundation-model approach gave the strongest balance of accuracy, error profile, and deployment simplicity, and now powers the live demo.
Problem & framing
The question is narrow and practical: can a chest X-ray be flagged as more consistent with a normal or a pneumonia-like pattern, in a way that supports triage-oriented review? The goal is prioritization support, not diagnosis.
That framing is itself an engineering decision. Good healthcare ML includes deciding what not to claim. CXR Triage is presented as an AI-assisted educational prototype — not a radiologist replacement or a clinically validated device.
Data
The project uses the public Kaggle chest X-ray pneumonia dataset (labels: NORMAL, PNEUMONIA), with 5,216 training, 16 validation, and 624 test images.
Three data realities shaped everything downstream: the set is imbalanced toward pneumonia, the provided validation split is tiny (16 images), and the population does not represent a real African hospital deployment. These limits are part of the project’s value as an honest case study.
Methodology
Rather than jumping straight to the strongest approach, three model families were compared in sequence — so the performance gains from each step stay visible instead of hidden behind one final number.
- Baseline CNN from scratch — a transparent starting point.
- MobileNetV2 transfer learning — pretrained visual features.
- MedSigLIP embeddings + logistic regression — a medical foundation-model workflow (image → 1152-d embedding → lightweight classifier).
Results
Accuracy rose at every stage, but the more important story is the error profile: the foundation-model pipeline kept false negatives low while sharply cutting false positives (228 → 148 → 54).
Test accuracy
Confusion matrices keep the comparison clinically honest — the goal is low false negatives and fewer unnecessary escalations of normal scans:
Baseline CNN
trained from scratch
rows: true N / P • green = correct
Catches pneumonia, but badly overcalls normal scans.
MobileNetV2
transfer learning
rows: true N / P • green = correct
A clear jump from pretrained features, still noisy on normal scans.
MedSigLIP + LogReg
foundation-model embeddings
rows: true N / P • green = correct
Best balance of sensitivity, specificity, and deployment simplicity.
Explainability
Before the foundation-model stage, the transfer-learning model was inspected with Grad-CAM across all four outcome types (true/false × positive/negative). On correct pneumonia cases, attention often fell on clinically plausible lower-lung regions — encouraging evidence the model was responding to relevant features, not artifacts.
Failure cases told the honest other half: attention was frequently broad or non-specific. Grad-CAM is an inspection tool, not proof of clinical correctness — a model can be right for the wrong reasons. Keeping that visible is part of responsible framing. (The public demo deliberately omits Grad-CAM to avoid implying diagnostic precision.)
Deployment
The work was not left in notebooks. A FastAPI backend wraps the MedSigLIP inference path and the logistic-regression artifact, deployed publicly on a Hugging Face Space. The classifier was verified to reproduce its saved prediction probabilities exactly before going live.
This frontend calls that live API directly — upload an X-ray, get a real prediction, confidence score, and a clinically careful triage interpretation.
Limitations & future work
This uses a public benchmark with a tiny validation split, possible label noise, and no external validation. It is not a clinically approved workflow and does not justify diagnostic claims — those boundaries are the point, not a footnote.
Next steps: stronger external evaluation, threshold calibration, richer error slicing, optional research-only explainability views, and validation on data closer to the intended deployment setting.
This is not a diagnostic tool. CXR Triage is for educational and research purposes only. Final decisions must be made by qualified healthcare professionals.