Pneumonia Detection from Chest X-rays
A college project: a CNN that flags pneumonia in chest X-rays, built in a team of three on a public Kaggle dataset.
- Role
- Team of 3 with Lamya Adenwala and Keenan Pereira
- Status
- SHIPPED
- Stack
- Python, TensorFlow, Keras, TPU
The problem
Can a CNN screen chest X-rays for pneumonia well enough to be a useful first pass before a radiologist looks?
Reading chest X-rays for pneumonia takes a radiologist's time, which is scarce in under-resourced settings. We wanted a model that screens X-rays quickly.
Constraints
- A public Kaggle chest X-ray dataset labelled normal or pneumonia: 1,349 normal and 3,883 pneumonia images in the training set.
- Keras on a TPU. Team of three with Lamya Adenwala and Keenan Pereira.
The system
- 01Built a Keras CNN following the Keras X-ray classification example and trained it on a TPU.
- 02Scored it on held-out test images for accuracy, precision and recall.
Result
- Test set: 74.7% accuracy, 71.4% precision, 99.2% recall.
- It catches almost every pneumonia case but raises false alarms on normal scans.
Limitations
- About three pneumonia images for every normal one in training, so the model leans towards saying pneumonia: 99.2% recall but 71.4% precision.
- A small training set and no GPU of our own (we trained on a free cloud TPU), which limited how far we could experiment. There is clear room to improve.
What I'd try next
- Class weighting or rebalancing to cut false alarms on normal scans.
- Fine-tuning pre-trained models such as ResNet50, DenseNet or VGG16, as planned in our proposal.
- Testing on other public chest X-ray sets, such as NIH Chest X-ray.
What I learned
- A high recall number can hide a model that says “pneumonia” too often. Precision shows the cost.
Links
Want to talk through how I built this?
I'm happy to walk through the decisions, what failed and what I'd change.