Skip to content

๐Ÿง  Detect brain tumors from MRI scans using MobileNetV2 deep learning! 86.6% accuracy with transfer learning. Complete EDA, visualization, and production-ready code.

License

Notifications You must be signed in to change notification settings

jonathanrao99/Brain-Tumor-Detection-using-Deep-Learning

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

4 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿง  Brain Tumor Detection using Deep Learning - Data Science Analysis

Python TensorFlow Keras Pandas Matplotlib License

Detect brain tumors from MRI scans using advanced deep learning! ๐Ÿš€

Comprehensive machine learning analysis for brain tumor classification using MobileNetV2


๐ŸŽฏ What's This?

A comprehensive deep learning analysis that classifies brain MRI scans to detect the presence of tumors using transfer learning with MobileNetV2. This project demonstrates the complete medical image analysis workflow from data preprocessing to model deployment! ๐Ÿง 

โœจ What You Get

  • ๐Ÿ“Š Complete exploratory data analysis (EDA)
  • ๐Ÿง  Transfer learning with MobileNetV2
  • ๐Ÿ“ˆ Interactive visualizations & insights
  • ๐Ÿค– Advanced deep learning models
  • ๐Ÿ“ Image preprocessing & augmentation
  • ๐Ÿ” Deep statistical analysis
  • ๐Ÿ“‹ Model performance evaluation
  • ๐ŸŽจ Beautiful visualizations with seaborn & matplotlib
  • โšก Production-ready code

๐Ÿš€ Quick Start

# 1. Clone it
git clone <your-repo-url>
cd Brain-Tumor-Detection-with-Data-Science

# 2. Install dependencies
pip install tensorflow pandas numpy matplotlib seaborn scikit-image pillow

# 3. Run the analysis!
jupyter notebook Brain_tumor.ipynb

That's it! ๐ŸŽ‰


๐ŸŽฎ How to Use

Option 1: Jupyter Notebook (Recommended)

jupyter notebook Brain_tumor.ipynb

Perfect for interactive analysis and learning

Option 2: Google Colab

# Upload Brain_tumor.ipynb to Google Colab
# Upload Brain Tumor.csv and Brain Scans.zip to your Colab session

For cloud-based analysis

Option 3: VS Code

# Open the notebook in VS Code with Jupyter extension

For integrated development experience


๐Ÿ“Š Key Insights Discovered

๐ŸŽฏ Brain Tumor Classification Analysis

  • Dataset Size: Brain MRI scans with tumor/no-tumor labels
  • Image Processing: Resized to 224x224 pixels for MobileNetV2
  • Model Architecture: Transfer learning with MobileNetV2 + custom classifier
  • Model Performance: 86.6% accuracy on test set
  • Training: 5 epochs with Adam optimizer and hinge loss

๐Ÿ“ˆ Model Performance

  • Deep Learning Model: 86.6% accuracy on validation set
  • Architecture: MobileNetV2 base + Global Average Pooling + Dense layer
  • Training: 5 epochs with validation monitoring
  • Transfer Learning: Pre-trained on ImageNet, fine-tuned for brain tumor detection

๐Ÿ” Technical Implementation

  • Data Quality: Comprehensive data validation and preprocessing
  • Image Processing: PIL-based resizing and normalization
  • Feature Engineering: MobileNetV2 preprocessing pipeline
  • Validation: Train-test split with validation monitoring

๐Ÿ› ๏ธ What's Inside

Brain-Tumor-Detection-with-Data-Science/
โ”œโ”€โ”€ ๐Ÿง  Brain_tumor.ipynb            # Complete analysis notebook
โ”œโ”€โ”€ ๐Ÿ“Š Brain Tumor.csv              # Dataset with image paths and labels
โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ Brain Scans.zip              # Brain MRI scan images
โ”œโ”€โ”€ ๐Ÿ“š README.md                    # This file
โ””โ”€โ”€ ๐Ÿ“„ LICENSE                      # MIT License

๐ŸŽจ Features

๐Ÿ“Š Exploratory Data Analysis

  • Comprehensive brain MRI data overview and statistics
  • Missing value analysis and data quality assessment
  • Class distribution analysis (tumor vs no-tumor)
  • Image visualization and sample display
  • Data preprocessing pipeline

๐Ÿ“ˆ Visualization Gallery

  • Brain MRI sample images
  • Class distribution plots
  • Training history visualization
  • Model performance metrics
  • Confusion matrix analysis

๐Ÿค– Deep Learning Models

  • MobileNetV2: Transfer learning with pre-trained weights
  • Image Preprocessing: Resize to 224x224, normalize pixel values
  • Model Evaluation: Accuracy, loss metrics, confusion matrix
  • Transfer Learning: Leverage ImageNet pre-trained features
  • Training History: Learning curves and validation metrics

๐Ÿ”ง Data Preprocessing

  • Image resizing to 224x224 pixels
  • Pixel value normalization
  • MobileNetV2 preprocessing pipeline
  • Train-test split with validation
  • Data validation and cleaning

๐Ÿ“Š Sample Output

๐Ÿง  Dataset Overview:
- Brain MRI scans with tumor/no-tumor classification
- Image processing: 224x224 pixel resolution
- Model: MobileNetV2 with transfer learning
- Data quality: Comprehensive preprocessing pipeline

๐ŸŽฏ Key Model Performance:
- Overall Accuracy: 86.6%
- Training Loss: 0.6955
- Validation Loss: 0.6872
- Model saved as: model_brain.h5

๐Ÿค– Neural Network Architecture:
- Base Model: MobileNetV2 (pre-trained on ImageNet)
- Global Average Pooling: 1280 features
- Output Layer: 1 neuron (binary classification)
- Total Parameters: 2,259,265 (1,281 trainable)

๐ŸŽช Fun Features

  • ๐Ÿง  Brain MRI visualization with matplotlib
  • ๐ŸŽฎ Transfer learning with MobileNetV2
  • ๐Ÿฅš Hidden pattern insights in medical images
  • ๐ŸŽจ Beautiful data visualizations
  • ๐ŸŽฏ Real-world medical AI application
  • ๐ŸŽช Educational deep learning workflow

๐Ÿ› Troubleshooting

Problem: ModuleNotFoundError: No module named 'tensorflow' Solution: pip install tensorflow pandas numpy matplotlib seaborn scikit-image pillow

Problem: Jupyter notebook not opening Solution: Install Jupyter: pip install jupyter

Problem: Dataset not found Solution: Ensure Brain Tumor.csv and Brain Scans.zip are in the same directory

Problem: GPU not detected Solution: Install GPU version: pip install tensorflow-gpu

Problem: Memory issues with large images Solution: Reduce image resolution or batch size


๐Ÿ”ง Technical Highlights

โœ… What I Analyzed

  • Brain MRI scans with tumor/no-tumor classification
  • Transfer learning with MobileNetV2 architecture
  • Image preprocessing pipeline for medical imaging
  • Deep learning model training and evaluation
  • Comprehensive EDA workflow for medical data
  • Statistical significance in medical AI applications

๐Ÿ“Š Data Quality

  • No missing values in the dataset
  • Balanced class distribution analysis
  • Image quality validation and preprocessing
  • Data types validated and corrected
  • Transfer learning optimization

๐Ÿ“ˆ Performance Metrics

  • Data Processing: Handles brain MRI scans efficiently
  • Visualization Quality: High-resolution medical image plots
  • Model Training: Fast training with transfer learning
  • Memory Usage: Efficient tensorflow operations
  • Reproducibility: Consistent results with fixed random state

๐Ÿค Contributing

  1. Fork it ๐Ÿด
  2. Create a branch ๐ŸŒฟ
  3. Make changes โœ๏ธ
  4. Submit PR ๐Ÿš€

Ideas welcome! ๐Ÿ’ก


๐Ÿ“Š Data Sources

  • Primary Dataset: Brain MRI scans with tumor classification
  • Features: Image pixels (224x224 resolution)
  • Target: Binary classification (tumor/no-tumor)
  • Application: Medical image analysis and AI diagnostics

โš ๏ธ Disclaimer

For educational and research purposes! This analysis uses brain MRI data to demonstrate deep learning concepts for medical image analysis. The insights help understand medical AI workflows and transfer learning applications! ๐Ÿค–


๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


๐ŸŒŸ Star the Repository

If you find this project helpful, please give it a โญ on GitHub!

GitHub stars

๐Ÿ“ž Connect & Support

GitHub LinkedIn Buy Me a Coffee


Made with โค๏ธ and โ˜• by Jonathan Thota

Detecting brain tumors, one MRI scan at a time! ๐Ÿง 

About

๐Ÿง  Detect brain tumors from MRI scans using MobileNetV2 deep learning! 86.6% accuracy with transfer learning. Complete EDA, visualization, and production-ready code.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published