This project implements an AI-powered Pneumonia Detection and Analysis System using a Convolutional Neural Network (CNN). The system is designed to detect pneumonia from chest X-ray images, providing predictions and detailed analysis through an interactive user interface built with Streamlit.
- Pneumonia Detection: Utilizes a custom-trained CNN model to detect pneumonia in chest X-ray images with high accuracy.
- Interactive User Interface: Built using Streamlit for a seamless and user-friendly experience.
- Security: Implements AES-256 encryption for image data to comply with HIPAA regulations.
pneumonia-detection/
├── chest_xray/ # Directory for dataset and image data
│ ├── train/
│ ├── val/
│ └── test/
├── Images # Directory for plotting images
├── models/ # Directory for trained models
│ ├── pneumonia_cnn.pth # Custom-trained CNN model
│ └── pretrained_model.pth # Pre-trained model (e.g., ResNet)
├── pneumoniaCNN.ipynb
├── transfer_learning.ipynb # Transfer learning
├── data_loader.py
├── CNN.py
├── train.py
├── UI.py # Interactive UI using Streamlit
├── pipeline.py # Pipeline for training and inference
├── Dockerfile # Docker configuration for containerized app
├── requirements.txt # Python dependencies
└── README.md # Project documentation
- Python 3.8+
- PyTorch
- Streamlit
-
Clone the repository:
git clone https://github.com/codewithdark-git/Pneumonia-Detection-from-Chest-X-Rays.git cd Pneumonia-Detection-from-Chest-X-Rays
-
Install the required dependencies:
pip install -r requirements.txt
-
To run the application locally with the Streamlit UI:
streamlit run UI.py
-
To run the pipeline for training the model:
python pipeline.py
The system employs the PneumoniaCNN
architecture, a custom-built CNN with three convolutional blocks and a fully connected layer. The model is trained using chest X-ray images, and both custom and pretrained models (such as ResNet) are available for comparison.
-
Custom Model Accuracy:
- Training Accuracy: 85%
- Testing Accuracy: 89%
-
Pretrained Model Accuracy:
- Testing Accuracy: 90%
- Data Encryption: All uploaded X-ray images are encrypted using AES-256 encryption.
- HIPAA Compliance: The system adheres to HIPAA regulations for secure handling of medical data.
- Mobile App: Develop a mobile version of the app for easier access in healthcare environments.
- Batch Processing: Implement a system for batch processing of multiple X-ray images.
- Model Optimization: Experiment with more advanced CNN architectures to improve accuracy and inference speed.
This project is licensed under the MIT License - see the LICENSE file for details.
- PyTorch: For building the deep learning models.
- Streamlit: For creating the interactive UI.