Inspiration

Pneumonia causes millions of infections every year, yet diagnosis still depends heavily on manual X-ray interpretation. I wanted to build an accessible tool that shows how AI can support, not replace, medical professionals, especially in settings where radiologists are overworked or unavailable. The idea was to create a simple, educational prototype that anyone can try.

What it does

The web app allows users to upload a chest X-ray and instantly receive:

  • A prediction: Normal or Pneumonia
  • A confidence score
  • A preview of the uploaded image

The model performs binary classification:

[ \hat{y} \in {0,1} ]

And the confidence score is computed as:

[ \text{Confidence} = \max(p, 1 - p) \times 100\% ]

How we built it

  • Used the Kaggle Chest X-Ray Pneumonia dataset
  • Trained a lightweight CNN in TensorFlow/Keras
  • Preprocessed images (150×150, scaling, augmentation)
  • Achieved ~94% training accuracy and ~80% test accuracy
  • Integrated the model into a Flask web app
  • Designed a clean UI using Bootstrap 5

Challenges we ran into

  • Matching preprocessing between training and Flask
  • Fixing environment issues (TensorFlow + macOS ARM conflicts)
  • Handling distorted X-ray previews in the UI
  • Dealing with dataset imbalance (more pneumonia images)

Accomplishments that we're proud of

  • Built a complete end-to-end ML + web system
  • Achieved reliable, fast predictions
  • Designed a simple, intuitive interface
  • Fully documented the project with a clean GitHub repo

What we learned

  • How to train and deploy CNNs
  • The importance of consistent preprocessing
  • Flask development for ML inference
  • Debugging full-stack ML applications
  • UX considerations for medical tools

What's next for Pneumonia X-Ray Detector

  • Cloud deployment (Render, AWS, DigitalOcean)
  • Adding Grad-CAM heatmaps for explainability
  • Training with more diverse datasets
  • Multi-disease classification expansion
  • Further UI/UX and accessibility improvements

Built With

Share this project:

Updates