🧠 Shepard's Gift: A Deep Learning Model for Brain Tumor Classification
"It's a beautiful day to save lives."
Inspired by Dr. Derek Shepherd from Grey's Anatomy — a neurosurgeon who never backed down from the impossible.
Shepard's Gift is a deep learning initiative to assist in diagnosing brain tumors using MRI scans. This repository contains Phase 1: Classification, where a custom Convolutional Neural Network (CNN) classifies brain MRI images into four categories:
- ✅ Glioma
- ✅ Meningioma
- ✅ Pituitary Tumor
- ✅ No Tumor
With meticulous optimization, the model achieves a validation accuracy of 98.25%, demonstrating high precision and clinical potential.
📊 Model Performance
| Metric and Values |
| Validation Accuracy | 98.25%
| Test Accuracy | 98.25%
| Optimizer | Adam
| Learning Rate | 0.0001
| Dropout Rate | 0.5
| Early Stopping | Yes (patience=10)
| Model Checkpoint | Yes (monitors val_loss)
📈 Learning Curves
- Smooth convergence with minimal overfitting.
- Validation metrics closely follow training curves before divergence triggers early stopping.
🤝 Confusion Matrix
- High precision and recall across all classes.
- Very few misclassifications — especially strong at identifying "No Tumor" cases.
📊 Visualizations are saved in the plots/ directory after training.
✨ Key Features
- High Accuracy: Reproducible 98.25% accuracy on test data.
- Custom CNN Architecture: Built from scratch using TensorFlow & Keras (4 convolutional blocks).
- Hyperparameter Optimization: Grid search with interactive 3D visualization (Plotly).
- Robust Training: EarlyStopping and ModelCheckpoint prevent overfitting.
- Reproducibility: Fixed random seeds for TensorFlow, NumPy, and Python.
- Well-Documented: Includes training logs, plots, and step-by-step instructions.
💾 Dataset & Setup
📁 Dataset Source
This project uses the
Brain Tumor MRI Dataset from Kaggle.
🗂️ Required Folder Structure
After downloading and extracting the dataset, organize your project like this:
🛠️ Technology Stack
Component
| Framework -> TensorFlow, Keras
| Language -> Python 3.8+ |
| Libraries -> Matplotlib, Seaborn, Scikit-learn, Plotly, NumPy |
| Hardware -> NVIDIA RTX 3050 (laptop gpu), CUDA & cuDNN |
| Visualization -> Interactive 3D plots with Plotly |
🔮 Future Work: Phase 2 — Tumor Segmentation
The next phase will implement a U-Net architecture for image segmentation, enabling:
- Precise tumor boundary detection
- Volumetric analysis
- Surgical planning assistance
- This will transform Shepard's Gift from a classifier into a clinical decision-support tool for neurosurgeons.
❤️ Dedicated to every patient, doctor, and researcher fighting brain tumors.
Let’s make the impossible, possible.