File size: 1,398 Bytes
0d89ca2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
license: mit
datasets:
- masoudnickparvar/brain-tumor-mri-dataset
metrics:
- accuracy
pipeline_tag: image-classification
library_name: keras
tags:
- cnn
- keras
- brain-tumor
- medical-imaging
- tensor-flow
- image-classification
language:
- en
---

Brain Tumor Detection CNN Model

This model was trained using a Convolutional Neural Network (CNN) to classify brain MRI images as either having a tumor or not. It uses Keras with TensorFlow backend and was trained on the publicly available [Brain Tumor MRI Dataset](https://www.kaggle.com/datasets/masoudnickparvar/brain-tumor-mri-dataset) from Kaggle.
 Dataset

The dataset contains 3,762 T1-weighted contrast-enhanced MRI images, labeled as:

- **Yes** – Images with a brain tumor
- **No** – Images without a brain tumor

The data is balanced and preprocessed into two folders: `yes/` and `no/`.

Train Accuracy: ~98% 
Validation Accuracy: ~96% 

## 🧠 Model Architecture

- Type: CNN
- Framework: Keras (TensorFlow backend)
- Input shape: `(150, 150, 3)`
- Final Activation: `sigmoid`
- Loss: `binary_crossentropy`
- Optimizer: `Adam`

Example (simplified):

```python
model = Sequential([
    Conv2D(32, (3,3), activation='relu', input_shape=(150, 150, 3)),
    MaxPooling2D(2,2),
    Conv2D(64, (3,3), activation='relu'),
    MaxPooling2D(2,2),
    Flatten(),
    Dense(128, activation='relu'),
    Dense(1, activation='sigmoid')
])