Skip to content

🧠 AI-powered brain stroke classification from MRI scans using custom-trained VGG19 model. Built with TensorFlow, deployed on Streamlit Cloud with interactive web interface. Features real-time predictions, confidence scores, and medical insights.

License

Notifications You must be signed in to change notification settings

AjayVasan/Brain-Stroke-Predictor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

42 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🧠 Brain Stroke MRI Predictor/Classifier

Open in Streamlit License: MIT Python

A custom-trained deep learning model to classify brain MRI images into various stroke types or detect the absence of stroke. Built with transfer learning using VGG19 and deployed using Streamlit for instant web-based predictions.


🌟 Live Streamlit Demo

Streamlit Demo

Experience the power of AI-driven medical imaging analysis:

  • πŸ“€ Drag & Drop your MRI scan (PNG, JPEG)
  • ⚑ Instant Predictions with confidence scores
  • πŸ“Š Interactive Visualizations and risk analysis
  • πŸ“± Mobile & Desktop responsive interface
  • 🎯 Real-time Classification of stroke types

No installation required - just upload and predict!


πŸ§ͺ Testing Images

Ready-to-use brain MRI samples for testing:

  • 🩸 Hemorrhagic Stroke samples
  • 🧠 Ischemic Stroke samples
  • βœ… No Stroke samples
  • πŸ“‹ Organized by category for easy identification

Use these test images to explore the model's capabilities!


πŸ“Š Project Overview

Feature Details
Model Type Custom-trained VGG19 with Transfer Learning
Input Format Brain MRI scans (PNG, JPEG, JPG)
Output Classes Hemorrhagic Stroke, Ischemic Stroke, No Stroke
Framework TensorFlow + Keras
Training Platform Google Colab (T4 GPU Runtime)
Dataset Brain Stroke Dataset - Teknofest 2021
Deployment Streamlit Cloud ⭐
Model Repository Hugging Face

πŸ—οΈ Model Architecture

  • Base Model: Pretrained VGG19 (ImageNet weights)
  • Custom Head: Dense layers for stroke classification
  • Data Augmentation: Rotation, zoom, flip for robust training
  • Training Environment: Google Colab T4 GPU
  • Fine-tuning: Specialized for medical imaging

πŸ““ Training Notebook: Brain_Stroke.ipynb
πŸ“Έ Training Insights: Images/ folder contains model performance visualizations


✨ Streamlit App Features

🎨 User Experience

  • Intuitive Interface: Clean, professional medical-grade UI
  • File Upload: Seamless drag-and-drop functionality
  • Real-time Processing: Instant analysis upon upload
  • Visual Feedback: Progress indicators and loading states

πŸ“ˆ Advanced Analytics

  • Confidence Scores: Percentage-based prediction reliability
  • Interactive Charts: Bar graphs showing class probabilities
  • Risk Assessment: Detailed prediction summaries
  • Medical Insights: Educational information about stroke types

πŸ”§ Technical Capabilities

  • Image Preprocessing: Automatic resizing and normalization
  • Model Integration: Direct connection to Hugging Face model
  • Error Handling: Robust file validation and error messages
  • Performance Optimized: Fast inference with caching

πŸš€ Quick Start with Streamlit

Option 1: Use the Live App (Recommended)

Simply visit: brain-stroke-predictor-ajayvasan.streamlit.app

Option 2: Run Locally

# Clone the repository
git clone https://github.com/AjayVasan/Brain-Stroke-Predictor.git
cd Brain-Stroke-Predictor

# Install dependencies
pip install -r requirements.txt

# Launch Streamlit app
streamlit run app.py

Note: Ensure you're using Python 3.10 as specified in runtime.txt


πŸ“ Repository Structure

Brain-Stroke-Predictor/
β”‚
β”œβ”€β”€ πŸš€ app.py                   # Main Streamlit application
β”œβ”€β”€ πŸ““ Brain_Stroke.ipynb       # Model training notebook (Colab)
β”œβ”€β”€ πŸ“Š Images/                  # Training visualizations & insights
β”œβ”€β”€ πŸ“‹ requirements.txt         # Python dependencies
β”œβ”€β”€ 🐍 runtime.txt              # Python version specification
β”œβ”€β”€ πŸ“„ LICENSE                  # MIT License
β”œβ”€β”€ 🐳 .devcontainer/           # Development container setup
└── πŸ“– README.md                # This file

πŸ› οΈ Technology Stack

Frontend & Deployment:

  • Streamlit - Interactive web application framework
  • Streamlit Cloud - Hosting and deployment platform

Machine Learning:

  • TensorFlow/Keras - Deep learning framework
  • VGG19 - Convolutional neural network architecture
  • Hugging Face - Model hosting and distribution

Development:

  • Google Colab - GPU-accelerated training environment
  • Python 3.10 - Programming language
  • GitHub - Version control and collaboration

πŸ”— Important Links

Resource Link
🌐 Live Streamlit App brain-stroke-predictor-ajayvasan.streamlit.app
πŸ§ͺ Testing Images Google Drive - Test Samples
πŸ€— Hugging Face Model Ajay007001/Brain-Stroke-Prediction
πŸ’» GitHub Repository AjayVasan/Brain-Stroke-Predictor
πŸ“Š Dataset Source Kaggle - Brain Stroke Dataset

πŸ§‘β€πŸ’» Author

Ajay Vasan
Machine Learning Developer | Medical AI Enthusiast


πŸ“œ License

This project is licensed under the MIT License - see the LICENSE file for details.


⚠️ Medical Disclaimer

Important: This application is designed for educational and research purposes only. It should not be used as a substitute for professional medical diagnosis, advice, or treatment. Always consult with qualified healthcare professionals for medical decisions.


🀝 Contributing

Contributions, issues, and feature requests are welcome! Feel free to check the issues page.


⭐ Show Your Support

Give a ⭐ if this project helped you learn about medical AI and Streamlit deployment!


Made with ❀️+🧠 and deployed with Streamlit

About

🧠 AI-powered brain stroke classification from MRI scans using custom-trained VGG19 model. Built with TensorFlow, deployed on Streamlit Cloud with interactive web interface. Features real-time predictions, confidence scores, and medical insights.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published