Chest X-Ray Disease Detection

The Problem

Pakistan doesn't have enough radiologists. There's 1 radiologist for every 150,000 people. Right now, over 40,000 patients are waiting for someone to read their chest X-rays. When diagnosis gets delayed, people get sicker.

What We Built

An AI system that looks at chest X-rays and identifies diseases automatically. It detects pneumonia, TB, and infiltrates. The key part: it's not making the final diagnosis. A radiologist still does that. This just helps them work faster by flagging what looks abnormal and what specific diseases might be there.

How It Works

Upload a chest X-ray. The model tells you:

  • Is it normal or abnormal?
  • If abnormal, is it pneumonia, TB, infiltrates, or something else?
  • How confident is it?

The radiologist sees this and makes the final call.

Running It

Google Colab (Easiest)

  1. Go to colab.research.google.com
  2. Copy-paste the Python code
  3. Click Run
  4. Wait 5-10 minutes

Local Machine

pip install -r requirements.txt
python chest_xray_colab.py

What We Used

  • ResNet-50: A standard deep learning model that's good at image recognition
  • Transfer Learning: We took a model that already learned from millions of regular images, then taught it about chest X-rays specifically. This is way faster and works better than training from scratch. real chest X-rays from publicly available data

What It Can and Can't Do

It can:

  • Classify X-rays into 4 categories
  • Give a confidence score for each prediction
  • Help radiologists work faster
  • Run on basic hardware

It can't:

  • Replace the radiologist
  • Diagnose super rare diseases it wasn't trained on
  • Work with weird or low-quality X-rays
  • Guarantee 100% accuracy

What's Next

Right now this is working and could be deployed. Next steps would be getting actual radiologists to test it, making sure it works in real hospitals, and figuring out the regulatory stuff.

The Real Impact

A radiologist looking at X-rays all day gets tired. They miss things. Or they work so fast they make mistakes. This system could help them slow down, focus on the right images, and catch more diseases early.

In Pakistan specifically, this means rural clinics that don't have radiologists could send X-rays to a central hospital with radiologist oversight, or even let the radiologist review flagged cases first. Either way, more people get diagnosed faster.

Built With

  • chest-xray-14-dataset
  • colab
  • imageprocessing
  • numpy
  • python
  • sklearn
  • tensorflow
  • transfer-learning
  • vgg16
Share this project:

Updates