An AI-powered computer vision application that classifies stool samples according to the Bristol Stool Scale using deep learning.
- 📸 Multiple Input Methods: Upload images, take photos with camera, or provide image URLs
- 🤖 Advanced AI Model: Uses ResNet50 architecture for accurate classification
- 🎨 Image Preprocessing: Automatic contrast enhancement and noise reduction
- 📊 Confidence Scores: Real-time probability distribution across all 7 types
- 💡 Personalized Recommendations: Health tips based on classification results
- 📈 Analysis History: Track and export your analysis history
- 🤝 Continuous Learning: Users provide feedback to improve the model
- 🔧 Admin Dashboard: Review and classify user submissions
- 🚀 Model Retraining: Automated workflow for continuous improvement
- Install dependencies:
pip install -r requirements.txt- Run the main app:
streamlit run streamlit_app.pyThe app will be available at http://localhost:8501
- Push your code to GitHub
- Go to https://streamlit.io/cloud
- Click "Deploy an app"
- Enter:
waltgarcia/stool-AIand filestreamlit_app.py
Your app will be live at: https://blank-app-vdw2s266yel.streamlit.app/
This project includes a workflow to continuously improve the model:
- Users upload images and get predictions
- They can confirm or correct the classification
- Images are automatically saved for training
streamlit run admin_dashboard.py- Review user submissions
- Manually classify if needed
- Move approved images to training dataset
python retrain_model.py- Trains new model with user-provided data
- Automatically saves best weights
- Model improves with more data
See TRAINING_WORKFLOW.md for detailed instructions.
stool-AI/
├── streamlit_app.py # Main application
├── admin_dashboard.py # Admin panel for reviewing submissions
├── retrain_model.py # Script to train improved models
├── train_model.py # Original training script
│
├── data/
│ ├── user_submissions/ # User uploaded images
│ └── bristol_stool_dataset/ # Training dataset (type_1 through type_7)
│
├── model_weights.pth # Current model weights
├── requirements.txt # Python dependencies
└── README.md # This file
The Bristol Stool Scale classifies stool into 7 types:
| Type | Name | Classification |
|---|---|---|
| 1 | Separate hard lumps | Severe Constipation |
| 2 | Lumpy and sausage-like | Mild Constipation |
| 3 | Sausage-like with cracks | Normal |
| 4 | Smooth and soft sausage | Normal (Ideal) |
| 5 | Soft blobs | Normal |
| 6 | Mushy consistency | Borderline Diarrhea |
| 7 | Liquid consistency | Diarrhea |
- Frontend: Streamlit
- ML Framework: PyTorch
- Computer Vision: torchvision, OpenCV
- Data Processing: Pandas, NumPy
- Visualization: Plotly, Matplotlib
- Backbone: ResNet50
- Input Size: 224×224 pixels
- Output Classes: 7 (Bristol Stool Types)
- Preprocessing: Normalization + CLAHE enhancement
The app is deployed on Streamlit Community Cloud and accessible at:
https://stool-ai-waltgarcia.streamlit.app
This project is licensed under the MIT License - see the LICENSE file for details.
This tool is for informational and educational purposes only. It is not a substitute for professional medical advice, diagnosis, or treatment. Always seek the advice of a physician or qualified health provider with questions about medical conditions.
Walt Garcia - GitHub
Contributions are welcome! You can help by:
- Using the app and providing feedback
- Uploading images to improve the model
- Reporting bugs or suggesting features
- Sharing the app with others
Made with ❤️ using Streamlit and PyTorch