CNN-based classification of brain tumor types from MRI scans.
Source: Brain Tumor MRI Dataset (Kaggle)
4 classes: glioma, meningioma, notumor, pituitary — each split into Training/ and Testing/.
SimpleCNN with 10.7M parameters:
- 3 Convolutional blocks (32, 64, 128 filters)
- Batch Normalization + Dropout
- 2 Dense layers (256, 128 neurons)
- Softmax output (4 classes)
| Configuration | Accuracy | Loss | Change |
|---|---|---|---|
| Baseline | 42.39% | 3.2599 | - |
| Fine-tuned | 46.70% | 2.8472 | +4.31% |
Fine-tuned hyperparameters: LR=0.0005, Batch=16, Epochs=40
| Class | Precision | Recall | F1-Score |
|---|---|---|---|
| Glioma | 1.00 | 0.14 | 0.24 |
| Meningioma | 1.00 | 0.21 | 0.35 |
| No Tumor | 0.37 | 0.92 | 0.53 |
| Pituitary | 0.54 | 0.66 | 0.59 |
curl -LsSf https://astral.sh/uv/install.sh | shuv syncchmod +x download_dataset.sh
./download_dataset.shThe script checks UV, installs Kaggle CLI, prompts for credentials, and downloads to ./data/.
Manual alternative:
uv add kaggle
mkdir -p ~/.kaggle
# Create ~/.kaggle/kaggle.json: {"username":"your_username","key":"your_api_key"}
chmod 600 ~/.kaggle/kaggle.json
uv run kaggle datasets download -d masoudnickparvar/brain-tumor-mri-dataset -p ./data --unzipmake visualize # generate data exploration images
make train # train model (~2 hours, saves to models/)
make publish # push to GitHub + HuggingFaceuv run python scripts/data_exploration.py
uv run python scripts/train_models.py
uv run python scripts/predict_single_image.py data/Testing/glioma/Te-gl_1.jpgWeights hosted on HuggingFace: supakornn/Brain-Tumor-Classification
# Download model weights
git clone https://huggingface.co/supakornn/Brain-Tumor-Classification hf-model
cp hf-model/model/*.h5 models/- Low accuracy (46.70%) insufficient for clinical use
- Poor glioma detection (14% recall)
- Simple architecture inadequate for medical imaging
MIT License — Educational and research purposes.



