brain-mri-segmentation

Production-grade binary semantic segmentation of brain tumors from MRI scans - pixel-level mask prediction for low-grade glioma (LGG) regions.

Overview
| Task | Binary semantic segmentation (tumor vs. background) |
| Dataset | Mateusz Buda LGG MRI (TCGA) - 110 patients, 3 929 paired slices |
| Main model | SegFormer-B2 (nvidia/segformer-b2-finetuned-ade-512-512, ~25 M params) |
| Baseline | Small U-Net (4 levels, 32→256 ch, ~1.9 M params, hand-rolled) |
| Stack | PyTorch Lightning · Hydra · MLflow · DVC · FastAPI · Docker · GitHub Actions · MkDocs |
| License | MIT |
Visualizations
Qualitative results on held-out test slices - input FLAIR, ground-truth mask, and SegFormer-B2 prediction side by side:

Test-set metric comparison between the SegFormer-B2 main model and the U-Net baseline (Dice, IoU, pixel accuracy):

Sections
- Architecture - data flow, model choices, metrics rationale
- Training - running experiments, logging, overrides
- Serving - FastAPI endpoints, Docker deployment
- Benchmarks - vs literature, trade-offs
- Reproducibility - pinned environment, one-command re-run
- Limitations - failure modes, dataset bias
- Model card - HF Hub card template
Links
- Code: GitHub
- Model: Hugging Face
Disclaimer
Research/educational artifact only - not intended for clinical use.