This project focuses on detecting brain tumors from MRI images using Convolutional Neural Networks (CNNs) with transfer learning (ResNet50). The notebook includes preprocessing, model training, and evaluation steps to classify MRI scans as tumor or non-tumor.
The dataset used is Brain MRI Images for Brain Tumor Detection available on Kaggle.
- Images are categorized into two classes:
Yesโ MRI showing brain tumorNoโ MRI without tumor
The notebook follows these main steps:
-
Import Libraries
Usesnumpy,pandas,matplotlib,seaborn,opencv,tensorflow/keras. -
Data Preprocessing
- Load images and labels
- Split into train and test sets (80/20)
- Image normalization and augmentation
-
Model Architecture
- Based on ResNet50 with additional Dense and Dropout layers
- Activation: ReLU, Softmax
- Optimizer: Adam
-
Training
- Early stopping used to prevent overfitting
- Data augmentation applied via
ImageDataGenerator
-
Evaluation
- Accuracy, Confusion Matrix, and Classification Report
- Achieved high classification accuracy on test data
- Clear distinction between tumor and non-tumor cases
- Visualized performance using plots and confusion matrix
Make sure you have the following installed:
pip install numpy pandas matplotlib seaborn opencv-python tensorflow pillow scikit-learn