This project leverages Deep Learning technologies to detect pneumonia from chest X-ray images. Using models like CNN, ResNet50, InceptionV3, CheXNet, and ensemble learning, the system provides a reliable diagnostic tool for healthcare professionals. With Explainable AI (XAI) methods such as SHAP and LIME, the project ensures interpretability and transparency in predictions, making it highly suitable for clinical applications. Pneumonia is a lung infection causing inflamed air sacs filled with fluid or pus. Caused by germs like bacteria, viruses, or fungi, which enter through the air or spread from other infections.
Germs multiply in the lungs, causing inflammation and reducing oxygen flow to the blood.
- Introduction
- Dataset
- Methodology
- Deep Learning Models
- Explainable AI
- Results and Performance
- Applications
- Setup and Installation
- Usage
- Future Work
Pneumonia, a leading cause of mortality worldwide, particularly among children under five, demands timely and accurate diagnosis. Chest X-rays play a vital role, but challenges like overlapping features and inconsistent image quality complicate detection. This project automates pneumonia detection through deep learning techniques, aiding radiologists in making faster, more accurate decisions.
The dataset is sourced from the Guangzhou Women and Children's Medical Center and comprises 5,863 pediatric chest X-ray images categorized into:
- Normal
- Pneumonia
Set | Normal | Pneumonia |
---|---|---|
Training Set | 1,341 | 3,875 |
Validation Set | 8 | 8 |
Test Set | 234 | 390 |
To address class imbalance, data redistribution and weight adjustments were applied during preprocessing.
The implementation involves:
-
Data Preprocessing:
- Resizing images to 256x256 pixels.
- Converting grayscale images to RGB for compatibility with pre-trained models.
- Normalizing pixel intensity to [-1, 1].
-
Deep Learning Models:
- Implemented architectures like CNN, ResNet50, CheXNet, and InceptionV3.
- Ensemble methods were employed for robustness.
-
Explainable AI:
- Used SHAP and LIME for interpretability.
-
Evaluation Metrics:
- Accuracy, Precision, Recall, F1-Score, and AUC-ROC were used to evaluate performance.
The baseline model, featuring three convolutional layers, achieved high accuracy for spatial feature extraction.
Fine-tuned ResNet50 excelled with residual connections, achieving a robust accuracy of 97%.
Based on DenseNet-121, this model achieved an AUC of 1.00, ensuring accurate classification.
The modular architecture captured multi-scale features, achieving an AUC of 0.9945.
Combined predictions from CNN and ResNet50 using weighted voting, improving robustness and achieving an AUC of 0.988.
Transparency is essential in medical AI. This project uses:
- SHAP (SHapley Additive exPlanations): Highlights image regions influencing the model’s decision (red for pneumonia, blue for normal).
- LIME (Local Interpretable Model-agnostic Explanations): Highlights critical regions responsible for predictions using interpretable superpixels.
These tools provide interpretability and build trust in AI systems.
Model | Accuracy | Precision (Pneumonia) | Recall (Pneumonia) | F1-Score (Pneumonia) | AUC |
---|---|---|---|---|---|
CNN | 94% | 0.98 | 0.98 | 0.98 | 0.93 |
ResNet50 | 97% | 0.97 | 0.99 | 0.98 | 0.991 |
CheXNet | 97% | 0.99 | 0.97 | 0.98 | 1.00 |
InceptionV3 | 97% | 0.97 | 0.98 | 0.98 | 0.994 |
Ensemble | 97% | 0.98 | 0.98 | 0.98 | 0.988 |
-
Clinical Decision Support:
- Acts as a "second opinion" for radiologists.
- Highlights suspicious regions for quicker diagnosis.
-
Medical Training:
- Assists new radiologists in identifying critical areas in X-rays.
-
Emergency Diagnostics:
- Facilitates triage in resource-constrained or pandemic scenarios.
- Clone the repository:
git clone https://github.com/your-username/pneumonia-detection.git