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 (2)

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.

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)

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 abstract (PDF)

Related guides

All guides
Illustration of object tracking showing video frames with bounding boxes and persistent ID labels following people and vehicles, comparing motion prediction and appearance matching.B.E./B.Tech Computer Science and Electronics students building video analytics projects — people counting, vehicle tracking, sports analysis — who have detection working and need

Object Tracking: DeepSORT and ByteTrack Explained

Detection finds objects per frame; tracking keeps their identities across frames. This guide explains tracking-by-detection, Kalman motion models, DeepSORT's appearance embeddings vs ByteTrack's low-confidence box recovery, tracking metrics (HOTA, IDF1, ID switches), and the tuning parameters that determine real-world quality.

Read guide
Illustration of image segmentation showing U-Net's U-shaped encoder-decoder with skip connections producing pixel masks, alongside Mask R-CNN detecting instances with masks.B.E./B.Tech Computer Science and AI/ML students moving from image classification or detection to pixel-level understanding — medical imaging, defect detection, autonomous driving

Image Segmentation: U-Net and Mask R-CNN

When projects need pixel-level answers, segmentation delivers. This guide explains semantic vs instance vs panoptic segmentation, U-Net's encoder-decoder with skip connections, Mask R-CNN's parallel mask head, Dice and IoU evaluation, paired augmentation, and how to choose the right architecture for your data and question.

Read guide
Illustration of Whisper speech-to-text showing sound waves flowing into a neural network and emerging as transcribed text with timestamps and speaker labels.B.E./B.Tech Computer Science and AI/ML students adding speech-to-text to projects — voice assistants, meeting transcription, accessibility tools

Whisper for Speech-to-Text in Student Projects

Whisper transcribes speech in dozens of languages with no training required. This guide covers how it works, choosing among model sizes, running it locally with faster-whisper, handling hour-long audio, timestamps and speaker diarization, multilingual quirks, and honest evaluation with word error rate.

Read guide
Get a quotation