An Advanced Computer Vision System for Automated Brain Tumor Classification using Random Forest Ensemble Learning.
View Demo โข Installation โข How It Works โข Tech Stack
NeuroDetect is a powerful medical imaging analysis system designed to classify brain MRI scans into four categories: Normal, Glioma, Meningioma, and Pituitary Tumor.
It features a fully interactive Web Dashboard built with Flask, providing real-time diagnostics, performance analytics, and printable medical reports โ bringing AI from code to clinical usability.
- ๐ฅ Web-Based Dashboard
- โก Real-Time Diagnosis
- ๐ Confusion Matrix & Class Distribution Charts
- ๐ Probability Breakdown for All Classes
- ๐งพ Printable Medical Reports
- ๐ก Robust Validation & Error Handling
| Interactive Dashboard | Diagnostic Result & Report |
|---|---|
![]() |
![]() |
| Class | Description |
|---|---|
| 0. Normal | Healthy brain with no detected tumor. |
| 1. Glioma Tumor | Tumor occurring in the brain/spinal cord. |
| 2. Meningioma Tumor | Tumor forming on protective membranes of brain/spinal cord. |
| 3. Pituitary Tumor | Abnormal growth in the pituitary gland. |
- Python 3.x
- Scikit-Learn (Random Forest Classifier)
- OpenCV (Image preprocessing)
- NumPy & Pandas
- Flask
- Jinja2
- HTML5 / CSS3
- Matplotlib & Seaborn
- JavaScript (AJAX)
- Convert MRI โ Grayscale
- Resize to 128ร128
- Flatten to 1D vector
- Normalize for model compatibility
- Random Forest Classifier (Ensemble Learning)
- Automatically trains on first app launch
- 80/20 train-test split
- High accuracy & reduced overfitting
- User uploads an image
- Processed via
BytesIO(not saved on disk) - Model outputs:
- Predicted class
- Confidence probability of each class
- UI dynamically updates with results
git clone https://github.com/AmrBedir/NeuroDetect_RandomForest.git
cd NeuroDetectpip install -r requirements.txtIf missing requirements.txt, install manually:
pip install flask scikit-learn opencv-python matplotlib seaborn pandas pillowEnsure your dataset is placed as follows (After unzipping each file):
/brain_tumor_dataset
/glioma_tumor
/meningioma_tumor
/normal
/pituitary_tumor
python app.pyNavigate to:
http://127.0.0.1:5000/
The model will auto-train on first run. Wait for the "System Ready" message.
| Metric | Score |
|---|---|
| Accuracy | ~79.35% |
| Precision | 80.11% |
| Recall | 79.35% |
| F1-Score | 79.26% |
(Exact metrics may vary depending on dataset + random seed.)
- ๐ Switch to CNN Models (VGG16, ResNet50, EfficientNet)
- ๐งฌ Add 3D MRI support (NIfTI)
- โ๏ธ Cloud Deployment (AWS / Render / Heroku)
- ๐ฑ REST API for Mobile Integration
- ๐ Automated Reporting + Multi-User Accounts
Developed by NeuroDetect Team โ FCIS, Mansoura University
|
Amr Bedir GitHub โข LinkedIn |
Kareem Mohamed Gomaa GitHub โข LinkedIn |
Madonna Ebrahim GitHub โข LinkedIn |
Christine Amir GitHub โข LinkedIn |
Karoline Rushdy GitHub โข LinkedIn |
- Dr. Mohamed ElMogy
- Eng. Yasmeen Al-Saqqar
This project is for educational & research purposes only.
It is NOT intended for medical diagnosis or treatment.
Always consult certified medical professionals.
Licensed under the MIT License.
See the LICENSE file for full details.
Made with โค๏ธ fueled by โ

