TK
Menu

Data Science / Machine Learning

COVID-19 Chest X-Ray Classification (VGG16)

Transfer learning with VGG16 to classify chest X-rays as COVID-19, pneumonia or normal, with augmentation, early stopping and fine-tuning, and an honest look at why it didn't generalise.

Problem

Early in the pandemic, PCR tests were slow and scarce. Could a chest X-ray help triage patients? This project tests that at small scale: can a pretrained image model tell COVID-19 apart from pneumonia and normal lungs?

Approach

  • Public chest X-rays (COVID-19 cases from the open COVID-19 image data collection, plus pneumonia and normal images).
  • Keras ImageDataGenerator augmentation: rescaling, rotation, zoom and flips.
  • VGG16 with ImageNet weights as a frozen base and a new three-class head, trained with checkpointing, early stopping and learning-rate reduction, then fine-tuned with the top layers unfrozen.

Result

Training loss and accuracy

  • Best validation accuracy about 0.74; test accuracy 0.40, rising to 0.50 after fine-tuning (219 test images).
  • With three classes, guessing scores about 0.33, so the model does not generalise. Likely causes: too few COVID-19 images and classes drawn from different sources, which lets a model learn the hospital rather than the disease.

What this shows

Transfer learning and a modern training set-up, and the judgement to report a weak result plainly and explain it: shortcut learning from mixed data sources is a real risk in medical AI. Not for clinical use.