This repository contains code for training and evaluating a MobileNetV3-based model to classify brain MRI images according to the presence or absence of tumors.
Train a binary image classification model using MobileNetV3 to distinguish between:
- MRI images with brain tumors
- MRI images without brain tumors
- Source: Kaggle - Brain Cancer MRI Dataset
- Classes: 'brain_glioma', 'brain_menin', 'brain_tumor'
- Image format:
.jpg - Input size: 224x224 pixels
- Resize images to 224x224
- Normalize pixel values
- Split into training and validation sets
- Data augmentation using
ImageDataGenerator
- Base architecture:
MobileNetV3Largepre-trained on ImageNet - Custom head:
- GlobalAveragePooling2D
- Dropout (rate = 0.2)
- Dense layer with 1 unit and sigmoid activation
- Optimizer: Adam
- Loss function: Binary Crossentropy
- Metric: Accuracy
- Epochs: 10
- Batch size: 32
- EarlyStopping monitoring
val_losswith patience of 3 epochs
- Best validation accuracy: 95.71% at epoch 9
- Best validation loss: 0.1289 at epoch 9
- Accuracy gap (train vs validation): 11.97%
- Python ≥ 3.7
- TensorFlow ≥ 2.x
- matplotlib
- numpy
- scikit-learn
Install dependencies:
pip install -r requirements.txtTo train the model:
python MobileNetV3.ipynbOr open the notebook using Jupyter:
jupyter notebook MobileNetV3.ipynb├── MobileNetV3.ipynb # Main notebook
├── /dataset/ # Image dataset (not included)
├── /plots/ # Accuracy and loss charts (optional)
├── README.md
└── requirements.txt # Optional dependencies file
This project is licensed under the MIT License.