Automated brain tumor (glioma) segmentation from multi-modal MRI scans using a lightweight deep learning model, built for low-resource healthcare settings
# 3D Glioma Segmentation with U-Net
A lightweight 3D U-Net web app for automated brain tumor (glioma) segmentation from multi-modal MRI scans, optimized for CPU-only inference.
**Live app:**
yargamji-brain-tumor-segmen…
## Overview
This project implements an end-to-end pipeline for segmenting glioma sub-regions (necrotic/tumor core, edema, enhancing tumor) from 3D brain MRI scans, using a lightweight 3D U-Net architecture designed to train and run on standard CPUs rather than requiring a GPU. The trained model is deployed as an interactive Streamlit app where users can upload MRI scans and receive a segmentation prediction with visualization and a downloadable result.
The project was built as part of a transition from clinical medicine into data science, and follows the Lightweight Brain Tumor Segmentation on Low-Resource Systems tutorial developed by the Medical Artificial Intelligence (MAI) Lab, Lagos, and SPARK, with several adaptations described below.
## Dataset
BraTS-Africa 2024 — 95 glioma cases from The Cancer Imaging Archive (TCIA), each with four MRI modalities (T1n, T1c, T2f, T2w) and expert-annotated segmentation masks for three tumor sub-regions.
## Model & Training
- **Architecture:** Lightweight 3D U-Net (fewer layers and filters than standard 3D U-Net implementations, to reduce memory footprint)
- **Input:** 96×96×96×4 patches (4 stacked MRI modalities)
- **Loss:** Combined Dice Loss + Categorical Focal Loss
- **Optimizer:** Nadam, learning rate 0.001, with gradient clipping
- **Hardware:** Trained entirely on CPU
- **Training time:** ~2.1 hours (26 epochs, early stopping on validation loss)
- **Validation Dice score:** ~0.54
## Live Demo
The deployed app accepts four NIfTI files per case (T1n, T1c, T2f, T2w) and optionally a segmentation mask for side-by-side comparison. It outputs:
- A slice-by-slice visualization of the input scan, predicted segmentation, and ground truth (if provided)
- A downloadable NIf …