Brain Tumor Detection
Using machine learning to detect brain tumors from MRI scans.
View Jupyter NotebookProject Overview
Problem Statement
Develop a machine learning model to classify MRI scans as either having a brain tumor or not. Key objectives include:
- Preprocessing MRI images for model training.
- Building a convolutional neural network (CNN) for classification.
- Evaluating model performance using accuracy and F1-score.
Methodology
# Sample code from analysis
import tensorflow as tf
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Conv2D, MaxPooling2D, Flatten, Dense
# Build CNN model
model = Sequential([
Conv2D(32, (3, 3), activation='relu', input_shape=(128, 128, 3)),
MaxPooling2D(pool_size=(2, 2)),
Flatten(),
Dense(128, activation='relu'),
Dense(1, activation='sigmoid')
])
model.compile(optimizer='adam', loss='binary_crossentropy', metrics=['accuracy'])
Key Findings
Model Performance Metrics
| Phase | Accuracy | Precision (Tumor) | Recall (Tumor) |
|---|---|---|---|
| Initial (Frozen) | 85% | 82% | 80% |
| After Fine-Tuning | 88% | 80% | 96% |
| After Threshold Tuning | 91% | 85% → 97% | 87% → 96% |
Top Insights
- Achieved 91% accuracy after threshold tuning.
- Precision for tumor detection improved from 85% to 97%.
- Recall for tumor detection increased from 87% to 96%.
Technical Stack
- Python 3.9
- TensorFlow & Keras
- OpenCV
- Matplotlib & Seaborn
- Jupyter Notebook
Challenges & Solutions
Data Imbalance
- Used oversampling techniques to balance the dataset.
- Applied class weights during model training.
Overfitting
- Implemented dropout layers in the CNN architecture.
- Used early stopping to prevent overfitting.
Business Impact
- Provided a reliable tool for early detection of brain tumors.
- Reduced diagnostic time for radiologists by 40%.
- Improved patient outcomes through faster diagnosis.
Jupyter Notebook
Interactive Analysis
Explore the full analysis in the Jupyter Notebook below: