← Back
University courseworkDeep Learning — Final projectGroup project

Pneumonia classification on chest X-rays

From a dense network to MobileNetV2 transfer learning and GAN-generated data, with a single held-out test evaluation

Problem

Classify X-rays as normal or pneumonia, comparing the course's techniques in a controlled way.

Data

Chest X-Ray Images (Pneumonia), Kaggle (paultimothymooney/chest-xray-pneumonia), downloaded with kagglehub.

Data source →

Methods

  • Image manifest and audit (dimensions, corrupt files, hashes)
  • Duplicate removal and test-set protection
  • Class weights
  • Dense net, CNN, optimisers, regularisation and normalisation
  • Transfer learning with MobileNetV2 (fine-tuning the last 30 layers)
  • GAN to generate normal X-rays and a controlled comparison
  • Model selection by validation ROC-AUC and threshold by Youden's index

Results

  • Winning model (by validation ROC-AUC): MobileNetV2 with the last 30 layers fine-tuned; 0.6474 threshold fixed on validation.
  • Held-out test (618 images, evaluated once): 96.31% ROC-AUC, 99.74% sensitivity (386 of 387 pneumonia cases), 51.95% specificity, 81.88% accuracy.
  • The specificity drop vs validation (97.78%) is documented as a generalisation gap; the threshold was not re-tuned on the test set.
  • GAN: 500 synthetic normal X-rays raised the CNN's specificity from 91.85% to 93.70% (false positives from 22 to 17).
  • Batch Normalization collapsed to the majority class (100% recall, 0% specificity): a documented example of why recall alone is not enough.

Tools

PythonTensorFlow / Kerasscikit-learnDatabrickskagglehub

University work; no claim of sole individual authorship.