A machine learning-powered diagnostic tool developed using TensorFlow/Keras, OpenCV, and Streamlit, designed to detect pneumonia in chest X-ray images. The system offers explainability features, clinical recommendations, and report generation, supporting fast and accurate diagnosis in low-resource healthcare settings.
- Overview
- Features
- Technologies Used
- Installation and Setup
- Dataset and Preprocessing
- Usage
- Project Structure
- Contributing
- Authors and Acknowledgements
The Chest X-ray Pneumonia Detection System aims to:
- Provide an accessible, ML-based method to classify chest X-rays as Normal or Pneumonia.
- Integrate a trained Convolutional Neural Network (CNN) with a Streamlit frontend for seamless user interaction.
- Offer clinical insights such as saliency maps, severity grading, and follow-up recommendations.
- Support remote diagnosis by exporting results and advice as a PDF report using the
fpdflibrary.
-
Model Inference
- Classifies chest X-rays into Normal or Pneumonia.
- Confidence scores and model accuracy displayed.
-
Clinical Decision Support
- Patient symptom descriptions and follow-up recommendations.
- Severity grading and feature markers (e.g., opacity, consolidation).
-
Explainability
- Saliency maps to visualize attention regions in the image.
- Expandable model architecture and layer information.
-
Report Generation
- PDF report download with diagnosis summary and advice.
-
Performance
- CPU inference time < 2 seconds per image.
- Tested on 5,800+ samples with accuracy > 92%.
- Frontend: Streamlit, HTML/CSS (Bootstrap-inspired)
- Backend: Python, TensorFlow/Keras, OpenCV, PIL
- Reporting: fpdf (PDF generation)
- Modeling: CNN, XGBoost (optional comparative mode)
- Database: SQLite (for logging/testing)
-
Clone the Repository:
git clone https://github.com/Avjot-Chawla/Chest-Xray-Pneumonia-Detection.git cd Chest-Xray-Pneumonia-Detection -
Install Requirements:
pip install -r requirements.txt
-
Run the Application:
streamlit run app.py
⚠️ If using a pretrained model, place the.h5model file in themodels/directory and update the model loading code accordingly.
-
Split: 70% Train, 15% Validation, 15% Test
-
Preprocessing:
- Resize to
180x180pixels - CLAHE contrast enhancement
- Normalization to [0,1] pixel range
- Augmentation: random flip, zoom, rotation
- Resize to
-
Upload an Image:
- Supported formats:
.jpg,.jpeg,.png
- Supported formats:
-
Review Results:
- View prediction results for both CNN and XGBoost models (if enabled).
- View saliency maps and architecture details.
-
Download Report:
- Click “Download Full Report” to save PDF containing analysis and recommendations.
Chest-Xray-Pneumonia-Detection/
├── models/ # Trained model files
├── app.py # Streamlit main app
├── utils/ # Preprocessing, prediction, and PDF functions
├── assets/ # Sample images or UI resources
├── requirements.txt # Required Python libraries
└── README.md # This file
Contributions are welcome! If you'd like to contribute a new feature or fix a bug:
- Fork the repo.
- Create a new branch.
- Submit a pull request with clear documentation.
- Tanushree Borase – RA2211003010575
- Avjot Singh Chawla – RA2211003010584
- Project Supervisor: Dr. Thamizhamuthu R Department of Computing Technologies, SRM Institute of Science and Technology