File size: 3,718 Bytes
5f4ae76
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a0baa7f
5f4ae76
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145

# 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.

---