An advanced deep learning-powered web application for pneumonia detection from chest X-rays using Streamlit and PyTorch.
- Real-time pneumonia detection from chest X-rays
- Interactive visualization with feature heatmaps
- Confidence meter for prediction reliability
- Detailed analysis reports
- Historical tracking of detections
- Responsive design with modern UI
- Comprehensive statistics dashboard
pneumoscan-ai-fyycvjlm6hh7xqhzasepey.streamlit.app/
- Python 3.8+
- Streamlit
- PyTorch & TorchVision
- OpenCV
- Plotly
- Pandas & NumPy
- PIL (Python Imaging Library)
- Python 3.8 or higher
- pip (Python package manager)
- Git
- Clone the repository:
git clone https://github.com/arpanksasmal/PneumoScan-AI.git
cd PneumoScan-AI- Create a virtual environment (recommended):
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install required packages:
pip install -r requirements.txtpneumoscan-ai/
├── app.py # Main Streamlit application
├── requirements.txt # Python dependencies
├── style.css # Custom CSS styles
├── model/
│ └── best_pneumonia_model_densenet121.pt # Trained model weights
├── detection_history/ # Folder for storing detection logs
├── test_data/ # Sample chest X-ray images for testing
│ ├── sample_1.jpg
│ ├── sample_2.jpg
│ ├── sample_3.jpg
| ├── sample_4.jpg
└── README.md # Project documentation
- Ensure you're in the project directory and virtual environment is activated
- Run the Streamlit app:
streamlit run app.py- Open your browser and navigate to
http://localhost:8501
The application uses a modified DenseNet121 architecture with:
- Custom classifier layers for binary classification
- Batch normalization and dropout for regularization
- Pre-trained weights for feature extraction
Our model achieves the following performance on the test set:
- Accuracy: 87.82%
- Precision: 90.00%
- Recall: 88.00%
- F1 Score: 87.00%
- AUC-ROC: 96.87%
Cross-validation results show consistent performance across different data splits, with a standard deviation of less than 1.5% for all metrics.
- The application is designed for testing and educational purposes
- Not HIPAA compliant by default
- Medical data should be handled according to relevant privacy regulations
- Use appropriate security measures when deploying in production
Follow the installation instructions above.
-
Streamlit Cloud (Easiest)
- Push code to GitHub
- Connect repository to Streamlit Cloud
- Configure requirements.txt
- Deploy
-
Heroku
- Create Procfile:
web: streamlit run app.py - Configure runtime.txt with Python version
- Deploy using Heroku CLI or GitHub integration
- Create Procfile:
-
AWS/GCP/Azure
- Use container services (ECS, GKE, AKS)
- Configure environment variables
- Set up load balancers if needed
To help users verify model predictions, we provide sample chest X-ray images in the test_data/ folder.
- Navigate to the
test_data/folder in your project directory. - Choose an image (e.g.,
sample_1.jpg). - Upload the image using the Streamlit web app.
- Click "Predict Pneumonia" to see the results.
This ensures a consistent and easy testing experience for users.
- This tool is for screening purposes only
- Not a replacement for professional medical diagnosis
- Consult healthcare providers for medical decisions
- Regular model updates recommended for optimal performance
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit changes (
git commit -m 'Add AmazingFeature') - Push to branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License – see the LICENSE file for details.
- Special thanks to OpenAI and Deep Learning Research Community
- Dataset sourced from Chest X-ray Pneumonia Dataset
This project serves as an advanced AI-driven tool for pneumonia detection. While it provides high accuracy and real-time predictions, it is intended for educational and research purposes only. Always consult medical professionals for official diagnoses.
- Arpan Kumar Sasmal
- LinkedIn: www.linkedin.com/in/arpan-kumar-sasmal-2b4421240
- Email: arpankumarsasmal@gmail.com
Created with ❤️ by Arpan Kumar Sasmal 😎