This project implements a Convolutional Neural Network (CNN) using the VGG-16 architecture for detecting brain tumors from MRI scans. The model achieves ~88% training accuracy and ~82% test accuracy using transfer learning techniques.
- Author: Sohan Maity
- Roll No: 523EC0001
- Email: 523ec0001@iiitk.ac.in
- Institution: Indian Institute of Information Technology Design and Manufacturing Kurnool (IIITDM Kurnool)
- Program: Samsung Innovation Campus - Final Project
The dataset contains MRI brain scan images classified into two categories:
- NO: No tumor detected (encoded as 0)
- YES: Tumor detected (encoded as 1)
Set | Images | Accuracy |
---|---|---|
Training Set | 169 images | ~88% |
Test Set | 84 images | ~82% |
- Base Model: VGG-16 pre-trained on ImageNet
- Input Shape: (224, 224, 3)
- Frozen Layers: All VGG-16 convolutional layers
- Custom Head: Global Average Pooling + Dense layers
VGG-16 Base (Frozen)
β
Global Average Pooling 2D
β
Dense(1024, activation='relu')
β
Dense(1024, activation='relu')
β
Dense(512, activation='relu')
β
Dense(2, activation='softmax')
pip install tensorflow keras opencv-python matplotlib scikit-learn plotly tqdm imutils numpy
-
Clone the repository
git clone https://github.com/sohan2311/brain-tumor-detection.git cd brain-tumor-detection
-
Install dependencies
pip install -r requirements.txt
-
Download the dataset
kaggle datasets download -d navoneel/brain-mri-images-for-brain-tumor-detection
-
Train the model
python train_model.py
-
Make predictions
python predict.py --image path/to/mri_scan.jpg
brain-tumor-detection/
β
βββ data/
β βββ brain_tumor_dataset/
β β βββ yes/ # Tumor images
β β βββ no/ # No tumor images
β βββ TRAIN/
β βββ TEST/
β βββ VAL/
β
βββ models/
β βββ brain_tumor_model.h5
β
βββ notebooks/
β βββ Brain_Tumor_Detection.ipynb
β
βββ src/
β βββ train_model.py
β βββ predict.py
β βββ data_preprocessing.py
β βββ model_architecture.py
β
βββ requirements.txt
βββ README.md
βββ LICENSE
- Image Resizing: 224Γ224 pixels
- Normalization: Pixel values scaled to [0, 1]
- Label Encoding: Binary classification (0: No Tumor, 1: Tumor)
- Data Split: 67% Training, 33% Testing
- Optimizer: Adam (learning_rate=0.01)
- Loss Function: Categorical Crossentropy
- Metrics: Accuracy
- Epochs: 15
- Batch Size: Default
Metric | Training | Validation |
---|---|---|
Accuracy | 88% | 82% |
Loss | 0.0007 | 0.6297 |
The model shows excellent learning progression:
- Epoch 1: 62.47% β Epoch 15: 100% (Training Accuracy)
- Validation Accuracy: Stabilized around 89-90%
- β Successful implementation of transfer learning
- β Good generalization despite small dataset
- β Effective feature extraction using VGG-16
β οΈ Signs of overfitting in later epochs
A brain tumor is an abnormal mass of cells in the brain, which can be:
- Benign: Non-cancerous
- Malignant: Cancerous
Common Symptoms:
- Persistent headaches
- Seizures
- Vision/speech difficulties
- Memory loss
- Personality changes
Early detection through MRI analysis can significantly improve treatment outcomes.
tensorflow>=2.0.0
keras>=2.0.0
opencv-python>=4.0.0
matplotlib>=3.0.0
scikit-learn>=1.0.0
plotly>=5.0.0
tqdm>=4.0.0
imutils>=0.5.0
numpy>=1.19.0
- Improve Accuracy: Implement ResNet, EfficientNet architectures
- Data Augmentation: Add rotation, zoom, flipping techniques
- Multi-class Classification: Detect different tumor types (Glioma, Meningioma, Pituitary)
- Web Deployment: Create Flask/FastAPI web application
- Mobile App: Develop mobile application for real-time detection
- Model Optimization: Implement model quantization for faster inference
The training process shows:
- Rapid Learning: Quick improvement in first 5 epochs
- Convergence: Model stabilizes around epoch 7-8
- Overfitting Signs: Training accuracy reaches 100% while validation plateaus
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the project
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
- Samsung Innovation Campus for providing the learning platform
- IIITDM Kurnool for academic support
- Kaggle Community for the dataset
- TensorFlow/Keras Teams for the excellent deep learning frameworks
- VGG Team for the groundbreaking architecture
Sohan Maity
- π§ Email: 523ec0001@iiitk.ac.in
- π Institution: IIITDM Kurnool
- π± Roll No: 523EC0001
β If you found this project helpful, please give it a star! β
Made with β€οΈ for advancing medical AI and brain tumor detection