| --- |
| 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') |
| ]) |