Pneumonia Detection from Chest X-Ray โ A Complete Project Overview
An end-to-end Deep Learning project that utilizes a Custom Convolutional Neural Network (CNN) to detect and classify instances of Pneumonia from chest X-ray images. The project includes a model training script, a confusion matrix visualization script, and a responsive web application built with Streamlit.
๐ Features
- Deep Learning Model: A custom-built, lightweight CNN model using TensorFlow & Keras.
- Accurate Detection: Classifies chest X-rays into Normal or Pneumonia.
- Interactive Web App: Easy-to-use Streamlit interface for seamless image uploads and real-time predictions.
- Evaluation Metrics: Scripts provided to evaluate model accuracy and generate visually appealing Confusion Matrices with Seaborn.
๐ ๏ธ Technologies Used
- TensorFlow & Keras: For designing and training the deep learning model.
- Streamlit: For quickly building an interactive, responsive front-end.
- Seaborn & Matplotlib: For plotting model metrics and matrices.
- NumPy & Pillow (PIL): For image processing and array manipulation.
๐ Project Structure
The project is well organized into the following structure:
app.py- The Streamlit web application frontendtrain_model.py- Script used to build and train the custom CNN modelgenerate_confusion_matrix.py- Script to plot a confusion matrix from test datarequirements.txt- Python dependencieschest_xray/- Dataset directorypneumonia_model_custom.keras- The saved trained model
๐ Getting Started & How It Works
1. Dataset
Using the Chest X-Ray Images (Pneumonia) dataset, I structured the data securely into training and testing folders with NORMAL and PNEUMONIA categories.
2. Training the Model
I trained a custom Convolutional Neural Network (CNN) from scratch using train_model.py. This evaluates the dataset and outputs a customized .keras model file.
3. Evaluating the Model
Evaluated the final output by generating a classification report and a beautiful Seaborn confusion matrix plot (confusion_matrix_improved.png).
4. Web Application
I built an easy-to-use visual interface via Streamlit. You can upload any X-ray image, and the model provides an instant prediction along with confidence levels.
๐งช Try It Live & View Code
Click here to try the Pneumonia Detection App
View the source code on GitHub
๐ Final Thoughts
This robust end-to-end Deep Learning application allows us to use advanced CNN architectures seamlessly through a web interface. It highlights the vast utility of AI inside medical image analysis architectures.
๐ Connect with Me
๐ www.tauqueeralam.com
๐ฑ LinkedIn | GitHub
View a live demo below:
View Demo
Discussion