Built to order

Pneumonia Detection using Chest X-Rays

This project builds a deep-learning classifier that screens frontal chest X-rays for pneumonia-related lung opacities. A DenseNet-121 network (ImageNet transfer learning) is fine-tuned on the RSNA Pneumonia Detection Challenge dataset — 26,684 radiographs labeled Normal, No Lung Opacity or Lung Opacity — with Grad-CAM heatmaps and opacity bounding boxes showing where the model looks. Academic prototype only: not a diagnostic device, and every finding needs radiologist review. Suitable for B.E./B.Tech final-year projects in Computer Science, AI/ML and Biomedical-adjacent programs.

Pneumonia Detection using Chest X-Rays — project thumbnail preview
More project photos (3)

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.

SYSTEM FLOW

5 components 5 connections

Live flow
Drag to explore
100%
storageRSNA X-ray dataset

26,684 frontal radiographs labeled Normal, No Lung Opacity or Lung Opacity; DICOM converted to 224x224 PNG.

Follow the working sequence

How it works

  1. RSNA DICOM radiographs are converted to PNG, resized to 224×224 and normalized with ImageNet statistics.
  2. The set is split into train/validation/test with stratification across the three classes; training images are augmented.
  3. DenseNet-121 (ImageNet weights) has its classifier head replaced with a 3-way output and is fine-tuned with cross-entropy loss.
  4. Every epoch logs training/validation loss, per-class precision/recall/F1 and ROC-AUC; the best checkpoint is kept.
  5. At inference the viewer app preprocesses the study, runs the model, and renders class probabilities.
  6. 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)

Related guides

All guides

Machine Learning Final Year Project Ideas with Datasets

This guide lists 30+ machine learning final-year project ideas grouped by type — tabular prediction, NLP, computer vision, and time series — each paired with a well-known public dataset from the UCI ML Repository or Kaggle. Pick a dataset with 1,000 to 50,000 rows: large enough to train a real model, small enough to iterate on a laptop. Confirm the license allows academic use and that it has a clear target column. Build a baseline model in week 1 so you always have something working. Avoid collecting your own dataset unless you have 2+ months to spare.

Read guide

Explainable AI for Student ML Projects: SHAP, LIME and Grad-CAM

"The model said so" is not an explanation. This guide covers the three explanation methods students actually use — SHAP for tabular models, LIME for text classifiers, Grad-CAM for CNNs — with runnable Python examples, honest reading rules, and the mistakes that make explanations misleading.

Read guide

CNN Transfer Learning for Students: Fine-Tuning ResNet and MobileNet in PyTorch

Train image classifiers on small datasets with transfer learning: load an ImageNet-pretrained backbone, freeze its early layers, replace the classification head for your classes, train the head first, then unfreeze late layers with a small learning rate for fine-tuning. This guide covers backbone choice (ResNet vs MobileNet vs EfficientNet), the exact PyTorch workflow, freezing strategy, data needs per class, and the errors that waste the most time.

Read guide
Get a quotation