A state-of-the-art deep learning application that uses Convolutional Neural Networks (CNN) to detect and classify brain tumors from MRI scans. This project provides an intuitive web interface built with Streamlit for real-time brain tumor prediction.
This project implements a sophisticated CNN model trained on brain MRI images to classify different types of brain conditions with high accuracy. The application can distinguish between:
- Glioma Tumor - A type of tumor that occurs in the brain and spinal cord
- Meningioma Tumor - A tumor that arises from the meninges
- No Tumor - Healthy brain scans
- High Accuracy: Achieves 94% accuracy in brain tumor classification
- Real-time Prediction: Upload MRI images and get instant results
- User-friendly Interface: Clean, intuitive Streamlit web application
- Multiple Tumor Types: Classifies 4 different categories including healthy brains
- Confidence Scores: Provides prediction confidence for each classification
- Image Preprocessing: Automatic image resizing and normalization
- Responsive Design: Works seamlessly across different devices
- Deep Learning Framework: TensorFlow 2.x / Keras
- Web Interface: Streamlit
- Image Processing: OpenCV, PIL
- Data Analysis: NumPy, Pandas
- Visualization: Matplotlib, Seaborn
- Model Architecture: Convolutional Neural Network (CNN)
The CNN model features a sophisticated architecture optimized for medical image classification:
- Input Layer: 224x224x3 (RGB MRI images)
- Convolutional Layers: Multiple Conv2D layers with ReLU activation
- Pooling Layers: MaxPooling2D for feature reduction
- Batch Normalization: For training stability
- Dropout Layers: Prevents overfitting
- Dense Layers: Fully connected layers for classification
- Output Layer: 4 neurons with softmax activation
- Training Accuracy: ~95%
- Validation Accuracy: ~94%
- Test Accuracy: ~94%
- Precision: High precision across all tumor types
- Recall: Excellent recall for critical tumor detection
- F1-Score: Balanced performance metric
Python 3.10
pip (Python package manager)- Clone the repository
git clone https://github.com/zahraghulam/Machine-Learning-projects-.git
cd Machine-Learning-projects-/Brain_Tumor_Prediction- Install required packages
pip install -r requirements.txt- Run the Streamlit application
streamlit run app.py- Open your browser and navigate to
http://localhost:8501
- Launch the Application: Run the Streamlit app using the command above
- Upload MRI Image: Use the file uploader to select a brain MRI scan
- Get Prediction: The model will automatically process the image and provide:
- Predicted tumor type
- Confidence percentage
- Visual display of the uploaded image
- Interpret Results: Review the classification and confidence score
- Data Collection: Curated dataset of brain MRI images
- Data Preprocessing: Image resizing, normalization, and augmentation
- Model Design: CNN architecture with multiple layers
- Training: Trained on GPU with early stopping and model checkpoints
- Validation: Cross-validation and performance evaluation
- Optimization: Hyperparameter tuning for best performance
The application provides comprehensive visualizations including:
- Prediction confidence charts
- Original vs. preprocessed images
- Model architecture diagrams
- Training/validation accuracy curves
This tool can assist healthcare professionals in:
- Early Detection: Quick screening of brain MRIs
- Second Opinion: Supporting radiologist diagnoses
- Educational Tool: Training medical students
- Research: Supporting brain tumor research initiatives
This application is for educational and research purposes only. It should not be used as a substitute for professional medical diagnosis. Always consult qualified healthcare professionals for medical decisions.
Contributions are welcome! Please feel free to:
- Fork the repository
- Create a feature branch
- Make your improvements
- Submit a pull request
zahra Batool
- LinkedIn: Connect with me
- GitHub: @zahraghulam
- Medical imaging datasets used for training
- TensorFlow and Keras communities
- Streamlit development team
- Healthcare professionals who provided domain expertise
This project is licensed under the MIT License - see the LICENSE file for details.
Built with ❤️ for advancing healthcare through AI