# Brain Tumor Detection System ### Tumor Classification & Segmentation using Deep Learning --- ## Overview This repository contains two complementary machine learning projects for brain tumor analysis using MRI scans: 1. **Brain Tumor Classification** * Classifies MRI images into categories (e.g., glioma, meningioma, pituitary tumor, or healthy). * Uses Convolutional Neural Networks (CNNs) for automated medical image analysis. 2. **Brain Tumor Segmentation** * Identifies and highlights tumor regions within MRI scans. * Employs U-Net (and/or other segmentation architectures) for pixel-wise classification. Together, these models provide a complete workflow for assisting radiologists in detecting and localizing brain tumors. --- ## Project Structure ``` Brain-Tumor-Detection-System ├── ML Project 1 Brain_Tumor_classification.ipynb # Classification notebook ├── ML Project 2 brain_tumor_segmentation.ipynb # Segmentation notebook ├── data/ # Dataset (MRI images) ├── models/ # Saved models ├── results/ # Predictions, segmented masks, visualizations ├── requirements.txt # Dependencies └── README.md # Project documentation ``` --- ## Installation & Setup 1. Clone the repository: ```bash git clone https://github.com/ayelefransi/Brain-Tumor-Detection-System.git cd Brain-Tumor-Detection-System ``` 2. Install dependencies: ```bash pip install -r requirements.txt ``` 3. Datasets: * Classification: MRI datasets with labeled tumor classes. * Segmentation: MRI scans with annotated masks. (Kaggle datasets such as Brain Tumor MRI Dataset and Brain Tumor Segmentation (BraTS) can be used.) --- ## Usage ### 1. Classification Run the classification notebook: ```bash jupyter notebook "ML Project 1 Brain_Tumor_classification.ipynb" ``` * Loads MRI images * Preprocesses data (resizing, normalization, augmentation) * Trains a CNN model * Evaluates performance (accuracy, precision, recall, F1-score) ### 2. Segmentation Run the segmentation notebook: ```bash jupyter notebook "ML Project 2 brain_tumor_segmentation.ipynb" ``` * Loads MRI scans and masks * Preprocesses data (contrast enhancement, normalization) * Trains U-Net (or similar) * Generates segmented tumor regions * Visualizes predictions vs. ground truth --- ## Results * **Classification** * Achieved high accuracy in distinguishing tumor types. * Confusion matrices and classification reports available in the notebook. * **Segmentation** * Successfully segmented tumor regions with high Dice Similarity Coefficient (DSC). * Visual comparisons between predicted masks and ground truth provided. --- ## Future Improvements * Integrate classification and segmentation into a single pipeline. * Deploy as a web application (e.g., Streamlit, Flask, or FastAPI). * Incorporate explainable AI (Grad-CAM, SHAP) for model interpretability. * Use larger datasets and transfer learning for improved generalization. --- ## Requirements * Python ≥ 3.8 * TensorFlow or PyTorch * OpenCV * NumPy, Pandas, Matplotlib, Seaborn * scikit-learn * Jupyter Notebook (Exact dependencies are listed in `requirements.txt`) --- ## Applications * Assisting radiologists in early tumor detection. * Supporting treatment planning with precise tumor localization. * Enabling research in medical imaging and deep learning. --- ## License This project is licensed under the MIT License – you may use, modify, and distribute it. ---