๐ซ Automated cardiac MRI segmentation โ U-Net precisely delineates Left Ventricle, Right Ventricle & Myocardium with 94.8% accuracy, empowering faster and more reliable clinical diagnostics.
โ๏ธ Medical Disclaimer: This system is an AI-assisted screening tool designed to support qualified medical professionals. All predictions require review by a licensed cardiologist before any clinical decision is made.
๐ Quick Start ย โขย ๐๏ธ Architecture ย โขย ๐ธ Screenshots ย โขย ๐ Results ย โขย ๐ฅ Team ย โขย โ Support
Traditional Segmentation โ Manual, hours per scan, error-prone, inconsistent across radiologists
HeartSeg AI โ Automated, sub-minute inference, 94.8% accuracy, reproducible results
HeartSeg AI is a deep learning-powered cardiac MRI segmentation system built as a Mini Project at Saveetha Engineering College. It implements the U-Net architecture to automatically segment critical heart structures โ Left Ventricle, Right Ventricle, and Myocardium โ from MRI scans, while also classifying the scan into one of 6 cardiac disease categories through a clean web interface.
๐ Institution: Saveetha Engineering College, Chennai ๐ Academic Year: 2024โ2025 ๐ง Model: U-Net with 94.8% segmentation accuracy ๐ฅ Clinical Use: Cardiac MRI diagnostic support
Manual cardiac MRI segmentation is a bottleneck in clinical cardiology โ it takes hours per scan, requires expert radiologists, and produces inconsistent results across practitioners. HeartSeg AI automates this entirely, delivering reproducible, high-accuracy segmentation in under a minute through a browser-based interface that integrates seamlessly into clinical workflows.
๐ง U-Net Segmentation Engine
- Encoder Path โ Captures multi-scale contextual features through progressive downsampling
- Bottleneck โ Processes the most compressed, abstract feature representation
- Decoder Path โ Precise localization through upsampling with skip connections
- Pixel-wise Output โ Generates full-resolution segmentation masks
- 3 Structure Segmentation โ Left Ventricle, Right Ventricle, Myocardium simultaneously
- 94.8% accuracy on validation MRI datasets
๐ฅ 6-Class Disease Classification
- Normal โ Healthy cardiac MRI
- Coronary Artery Disease โ Arterial blockage patterns
- Chronic Ischemic Disease โ Chronic blood flow restriction
- Heart Failure โ Reduced ejection fraction indicators
- Heart Valve Disease โ Structural valve abnormalities
- Irregular Heartbeat โ Arrhythmia-related structural changes
๐ Web-Based Clinical Interface
- Secure login system with session management
- Drag-and-drop MRI image upload
- Real-time segmentation visualization
- Overlay of predicted mask on original MRI
- Clean, responsive dark-themed UI
- Built with Flask + HTML5/CSS3
โก Automated Processing Pipeline
- Image normalization and preprocessing on upload
- Automatic model inference via
mri_segmentation.py - Post-processing and mask overlay generation
- Instant result rendering in browser
- No manual steps between upload and result
U-Net encoder-decoder architecture: MRI input โ feature extraction โ pixel-wise segmentation mask
Note: See the
architecture-diagram.htmlfile for an interactive version of this diagram.
| Component | File | Technology | Purpose |
|---|---|---|---|
| Web Server | app.py |
Flask | Routes, session auth, file handling |
| Segmentation Engine | mri_segmentation.py |
TensorFlow / Keras | U-Net inference pipeline |
| Trained Model | h5/heart_mri_model.h5 |
Keras SavedModel | Pre-trained U-Net weights |
| Training Pipeline | train.py |
TensorFlow 2.4.1 | Model training and evaluation |
| Login UI | templates/login.html |
HTML5 + CSS3 | Authentication interface |
| Upload UI | templates/upload.html |
HTML5 + CSS3 | MRI image submission |
| Result UI | templates/result.html |
HTML5 + CSS3 | Segmentation visualization |
| Styling | static/*.css |
CSS3 | Page-specific stylesheets |
User Login (Flask Session)
โ
โผ
MRI Image Upload (JPG/PNG)
โ
โผ
Preprocessing โ Normalize ยท Resize to (256ร256) ยท Expand dims
โ
โผ
U-Net Model Inference (heart_mri_model.h5)
Encoder โ Bottleneck โ Decoder
โ
โผ
Segmentation Mask (pixel-wise prediction)
โ
โผ
Disease Classification (6 classes)
โ
โผ
Overlay Visualization + Result Display
| Login Page |
|---|
![]() |
| Upload Page | Image Selection |
|---|---|
![]() |
![]() |
| Normal | Coronary Artery Disease |
|---|---|
![]() |
![]() |
| Chronic Ischemic Disease | Heart Failure |
|---|---|
![]() |
![]() |
| Heart Valve Disease | Irregular Heartbeat |
|---|---|
![]() |
![]() |
| VS Code โ Running Server |
|---|
![]() |
Miniproject/
โ
โโโ ๐ h5/
โ โโโ heart_mri_model.h5 # Pre-trained U-Net weights
โ
โโโ ๐ img/ # Screenshots & diagrams (10 images)
โ โโโ Login_Page.png
โ โโโ Upload_Page.png
โ โโโ Upload_Image_Selection_Page.png
โ โโโ Prediction_Result_Normal.png
โ โโโ Prediction_Result_Choronary_Artery_Disease.png
โ โโโ Prediction_Result_Chronic_Ischemic_Disease.png
โ โโโ Prediction_Result_Heart_Failure_Disease.png
โ โโโ Prediction_Result_Heart_Valve_Disease.png
โ โโโ Prediction_Result_Irregular_Heartbeat_Disease.png
โ โโโ VS_Code_Running_Status.png
โ
โโโ ๐ static/ # CSS stylesheets
โ โโโ login.css
โ โโโ upload.css
โ โโโ result.css
โ
โโโ ๐ templates/ # Jinja2 HTML templates
โ โโโ login.html
โ โโโ upload.html
โ โโโ result.html
โ
โโโ ๐ app.py # Flask web server + routes
โโโ ๐ mri_segmentation.py # U-Net inference pipeline
โโโ ๐ train.py # Model training script
โโโ ๐ requirements.txt # Python dependencies
โโโ ๐ LICENSE.txt # Proprietary license
โโโ ๐ README.md # This file
โ Python 3.6+
โ pip
โ 64-bit OS (Windows 10 or Ubuntu)
โ 4GB+ RAM (GPU recommended for training)
git clone https://github.com/Darkwebnew/Miniproject.git
cd Miniprojectpip install -r requirements.txtOr manually:
pip install tensorflow==2.4.1
pip install opencv-python
pip install numpy
pip install scikit-learn
pip install flaskpython app.pyOpen your browser at http://localhost:5000
python train.py
# Trained model will be saved to h5/heart_mri_model.h5| Metric | Value |
|---|---|
| Segmentation Accuracy | 94.8% โ |
| Architecture | U-Net (Encoder-Decoder) |
| Input Size | 256 ร 256 px |
| Segments | Left Ventricle ยท Right Ventricle ยท Myocardium |
| Disease Classes | 6 (Normal + 5 pathologies) |
| Framework | TensorFlow 2.4.1 / Keras |
| Model Size | heart_mri_model.h5 |
| Benefit | Detail |
|---|---|
| โฑ๏ธ Speed | Hours of manual segmentation โ sub-minute automated results |
| ๐ฏ Precision | 94.8% accuracy โ comparable to expert radiologist consistency |
| ๐จโโ๏ธ Clinical Value | Empowers cardiologists with reliable AI pre-screening |
| ๐ฅ Workflow | Browser-based โ integrates into any clinical environment |
| ๐ฌ Research | Demonstrates deep learning's transformative role in cardiac imaging |
| Category | Specification |
|---|---|
| OS | 64-bit Windows 10 or Ubuntu |
| Python | 3.6 or later |
| Deep Learning | TensorFlow 2.4.1 |
| Image Processing | OpenCV |
| Numerics | NumPy, scikit-learn |
| Web Framework | Flask |
| IDE | VSCode or PyCharm (recommended) |
| Role | Institution |
|---|---|
| Mini Project Supervisors | Saveetha Engineering College, Chennai |
โ ๏ธ Important: This project is under a restrictive proprietary license. Contributions are welcome strictly for educational improvement purposes only. By submitting a pull request, you agree your contribution becomes part of this project under the same license terms. No contributor may independently use, redistribute, or commercialize any part of this code.
- Open an Issue first โ discuss your idea before coding
- Fork the repository
- Create a branch โ
git checkout -b feature/YourFeature - Commit โ
git commit -m 'feat: Add YourFeature' - Push & open a Pull Request with a detailed description
| Area | Difficulty | Skills Needed |
|---|---|---|
| ๐ง Model Improvements (new architectures) | Advanced | Python, TensorFlow, Keras |
| ๐ Web Interface Enhancement | Medium | Flask, HTML, CSS |
| ๐ Additional Disease Classes | Advanced | Medical imaging, Deep learning |
| ๐ Documentation | Beginner | Markdown |
| ๐งช Evaluation Metrics (Dice, IoU) | Medium | Python, scikit-learn |
If HeartSeg AI helped your research or clinical project โ consider supporting continued development!
Your support helps build better AI healthcare tools for the community.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ PROPRIETARY SOFTWARE LICENSE โ
โ Copyright (c) 2024โ2025 Sriram V & HeartSeg AI Team โ
โ All Rights Reserved โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
This software and all associated source code, trained model weights, documentation, UI templates, screenshots, and assets are the exclusive intellectual property of the authors and are fully protected under applicable copyright law and the Indian Copyright Act, 1957.
- Copy, reproduce, or redistribute this code in whole or in part
- Use this project or any portion of it in commercial medical products or services
- Modify, adapt, or create derivative works based on this project
- Sublicense, sell, rent, or transfer rights to any third party
- Use this project's name, model weights, or research in your own publications without explicit written permission
- Deploy this system in any clinical, production, or commercial environment without written authorization
- Present this work as your own in academic or professional contexts
- View and study the source code for personal educational purposes only
- Fork on GitHub solely to submit pull requests
- Reference this project in academic citations with proper attribution
Any unauthorized use, reproduction, distribution, or clinical deployment of this software is strictly prohibited and may result in civil and criminal penalties. The authors reserve all rights and will pursue all available legal remedies for any violations.
For licensing inquiries: @darkwebnew via GitHub Issues
See the full LICENSE.txt for complete terms.
| Technology | Purpose |
|---|---|
| TensorFlow / Keras | U-Net deep learning framework |
| OpenCV | Medical image preprocessing |
| Flask | Web server and routing |
| NumPy | Numerical computation |
| scikit-learn | Evaluation metrics |
| Saveetha Engineering College | Academic support and guidance |
| ACDC Dataset | Cardiac MRI benchmark reference |
Academic References: Ronneberger et al. (U-Net, MICCAI 2015) ยท Bernard et al. (ACDC Challenge 2018)










