The problem
Pneumonia still kills hundreds of thousands of people a year, and the chest X-ray is the frontline diagnostic — yet reading one well takes a trained radiologist, and in many regions radiologists are scarce while imaging volumes keep rising. Computer-aided screening can help by triaging studies: flagging likely opacities for urgent review while clearly deferring the diagnosis to a human expert. This project builds that screening aid as a complete student system: a DenseNet-121 convolutional network fine-tuned on the public RSNA Pneumonia Detection Challenge dataset (26,684 frontal-view radiographs with radiologist-drawn bounding boxes around opacities), evaluated with per-class precision, recall and ROC-AUC on a held-out split, and wrapped in a study-viewer demo with Grad-CAM heatmaps, opacity boxes and a batch review queue. The report is explicit about what the model is — an educational pattern recognizer, not a medical device — and the demo carries that warning on every screen.
26,684 frontal radiographs labeled Normal, No Lung Opacity or Lung Opacity; DICOM converted to 224x224 PNG.
Follow the working sequence
How it works
- RSNA DICOM radiographs are converted to PNG, resized to 224×224 and normalized with ImageNet statistics.
- The set is split into train/validation/test with stratification across the three classes; training images are augmented.
- DenseNet-121 (ImageNet weights) has its classifier head replaced with a 3-way output and is fine-tuned with cross-entropy loss.
- Every epoch logs training/validation loss, per-class precision/recall/F1 and ROC-AUC; the best checkpoint is kept.
- At inference the viewer app preprocesses the study, runs the model, and renders class probabilities.
- Grad-CAM backpropagates the predicted class score to the last convolutional layer to produce the heatmap overlay.
Tech stack:
- Python 3.10, PyTorch (DenseNet-121, transfer learning)
- Torchvision (transforms, augmentation, DataLoaders)
- pydicom + PIL (DICOM conversion and preprocessing)
- scikit-learn (per-class metrics, confusion matrix, ROC-AUC)
- Matplotlib, Seaborn (training curves, heatmaps, ROC plots)
- Flask viewer app (study viewer, batch queue, metrics dashboard)
- RSNA Pneumonia Detection Challenge dataset (Kaggle, 26,684 radiographs)
| Parameter | Value |
|---|---|
| Dataset | RSNA Pneumonia Detection Challenge (Kaggle): 26,684 frontal-view chest X-rays; classes Normal / No Lung Opacity / Lung Opacity; radiologist bounding boxes for opacities |
| Model | DenseNet-121, ImageNet-pretrained, 3-way classifier head; 224×224 input |
| Task | 3-class radiograph classification + opacity localization boxes |
| Explainability | Grad-CAM heatmaps from the final convolutional block |
| Evaluation | Per-class precision/recall/F1, confusion matrix, one-vs-rest ROC-AUC — computed by the notebook on your validation split during your build |
| Design target | Macro-F1 approximately 0.80+ on the validation split (target, not a measured claim) |
| Demo | Flask viewer: study view, batch review queue, metrics dashboard |
| Safety status | Academic prototype only — not a diagnostic device, not clinically validated |
Project features
- [RSNA dataset pipeline] DICOM-to-PNG conversion, train/validation/test splits and augmentation (rotations, flips, contrast jitter) for the 26,684-image RSNA set, with the three-class taxonomy preserved.
- [DenseNet-121 classifier] ImageNet-pretrained DenseNet-121 fine-tuned for Normal / No Lung Opacity / Lung Opacity classification, with a training notebook logging loss, per-class metrics and ROC curves every epoch.
- [Grad-CAM explainability] Heatmap overlays generated from the final convolutional block show which lung regions drove each prediction, toggleable in the viewer.
- [Opacity bounding boxes] Predicted boxes with confidence scores localize suspected opacities, mirroring the radiologist annotations in the dataset.
- [Study viewer] Single-study analysis with overlay modes (original, heatmap, boxes, combined), prediction probabilities and DICOM metadata panel.
- [Batch review queue] A review grid across all three classes with filtering, so the demo walks through normal and abnormal studies.
- [Metrics dashboard] Confusion matrix, per-class precision/recall/F1 and one-vs-rest ROC curves computed by the notebook on your validation split.
- [Clinical-safety framing] Every screen carries the academic-prototype warning, and the report documents intended use, failure modes and why radiologist oversight is mandatory.
What is included
- Complete source code (dataset pipeline, training, evaluation, Grad-CAM, Flask viewer)
- Jupyter training notebook (buyer-run: preprocessing, fine-tuning, per-epoch metric logging)
- Project report PDF (background, dataset analysis, architecture, evaluation, error analysis, clinical-safety statement)
- PPT presentation for final review
- Viva Q&A preparation document (CNNs, transfer learning, Grad-CAM, ROC-AUC, medical-AI limits)
- Setup guide (environment, downloading the RSNA data from Kaggle, running training and the viewer)
Advantages
- Transfer learning: ImageNet-pretrained DenseNet-121 fine-tuned for Normal, No Lung Opacity and Lung Opacity on the 26,684-image RSNA set.
- Grad-CAM heatmaps from the final convolutional block show which lung regions drove each prediction, toggleable in the viewer.
- Opacity bounding boxes with confidence scores localize suspected opacities, mirroring the radiologist annotations in the dataset.
- Study viewer with overlay modes (original, heatmap, boxes, combined), prediction probabilities and a DICOM metadata panel.
- Batch review queue across all three classes with filtering, so the demo walks through normal and abnormal studies.
- Metrics dashboard with confusion matrix, per-class precision, recall and F1, and one-vs-rest ROC curves computed by the notebook on your validation split.
Disadvantages
- Academic prototype only, not a diagnostic device: every finding needs radiologist review, and the report and every demo screen state this explicitly.
- RSNA labels come from radiology reports with known label noise, and No Lung Opacity is a heterogeneous class, so the model can inherit that ambiguity.
- Training covers adult frontal-view radiographs only; performance on pediatric, lateral or portable bedside films is unknown and not claimed.
- No measured accuracy is stated anywhere: the notebook computes per-class metrics on your own validation split during your build.
- The model sees pixels, not patients: it has no access to symptoms, history or lab values that a radiologist uses, so its output is at most a triage signal.
Limitations & prerequisites
- This is an academic prototype and is not intended to replace certified medical equipment, professional diagnosis or clinical decision-making — the report and every demo screen state this explicitly.
- The RSNA labels come from radiology reports with known label noise, and "No Lung Opacity" is a heterogeneous class — the model can inherit that ambiguity, which the error analysis discusses.
- Training covers adult frontal-view radiographs only; performance on pediatric, lateral or portable bedside films is unknown and not claimed.
- No measured accuracy is stated anywhere: the notebook computes per-class metrics on your own validation split during your build, and the report presents those as your build's results against the stated design target.
- The model sees pixels, not patients — it has no access to symptoms, history or lab values that a radiologist uses, so its output is at most a triage signal.
Frequently Asked Questions
Which dataset is used?
The RSNA Pneumonia Detection Challenge (Kaggle, hosted from the 2018 RSNA AI challenge): 26,684 frontal-view chest X-ray images from the NIH Clinical Center, labeled Normal, No Lung Opacity or Lung Opacity, with radiologist-drawn bounding boxes around opacities. The NIH ChestX-ray14 set (112,120 images, 14 labels) is documented as an alternative.
Which model is used?
DenseNet-121 pretrained on ImageNet, fine-tuned with a replaced 3-way classifier head. DenseNet's dense connections suit medical images where subtle texture cues matter and data is limited.
Is the accuracy guaranteed?
No. Nothing is pre-measured — the training notebook logs per-class precision, recall, F1 and ROC-AUC on your validation split every epoch, and the report presents your build's actual numbers. The design target is macro-F1 ≈ 0.80+.
Can it diagnose pneumonia in a real patient?
No — and it must never be presented that way. It is an educational screening prototype. Real diagnosis requires a radiologist with clinical context; the demo and report carry this warning throughout.
What does Grad-CAM show?
A heatmap of which image regions most influenced the predicted class, computed from gradients at the last convolutional layer. It is an explanation aid for the demo and the viva — not proof the model "sees" pathology the way a radiologist does.
Can it work with our college's X-ray images?
Possibly, with caveats: the model expects frontal-view adult radiographs similar to the RSNA distribution. Different machines, pediatric cases or lateral views are out-of-distribution, and the report's limitations section covers exactly this. Suitable for B.E./B.Tech final-year projects in Computer Science, AI/ML and Biomedical-adjacent programs.
Components & software requirements
- Python 3.10, PyTorch (DenseNet-121, transfer learning)
- Torchvision (transforms, augmentation, DataLoaders)
- pydicom + PIL (DICOM conversion and preprocessing)
- scikit-learn (per-class metrics, confusion matrix, ROC-AUC)
- Matplotlib, Seaborn (training curves, heatmaps, ROC plots)
- Flask viewer app (study viewer, batch queue, metrics dashboard)
- RSNA Pneumonia Detection Challenge dataset (Kaggle, 26,684 radiographs)
Delivery information
Built-to-order project. Delivery timeline is shared after order confirmation based on current queue.
Support terms
Complete documentation, setup guide, and viva preparation included. Support for setup and explanation provided.
Download free synopsis (PDF)
Enter your name and WhatsApp number — the synopsis PDF downloads immediately. We may send occasional project updates on WhatsApp; no spam.
Kermany et al. (2018), Identifying Medical Diagnoses by Image-Based Deep Learning (Cell)