Reproducibility
This project is designed to produce identical results across re-runs on the same hardware. Here's how each moving part is pinned.
Random seeds
seed: 42inconfigs/config.yamlis threaded throughseed_everything()at the start ofsrc/brain_mri_segmentation/training/train.py.- Lightning's
deterministic="warn"mode avoids thenll_loss2d_forward_out_cuda_templatecrash while still catching non-deterministic kernels elsewhere. - Patient-level split is deterministic:
prepare.pyshuffles TCGA patient dirs withrandom.Random(seed=42)before the 88/11/11 partition — re-running always produces the same split.
Dependencies
pyproject.tomldeclares direct deps;uv.lockis committed and pins every transitive package version + hash..python-version=3.13— CI + local dev must match.- CUDA torch pinned via
[[tool.uv.index]] pytorch-cu124on Win/Linux. - CI runs the suite against Python 3.12 + 3.13 via a matrix strategy.
Data
data/sample/(8 paired image+mask TIFs) is in git — CI + smoke tests work without any external download.data/raw/anddata/processed/are DVC-tracked. DVC remote is local-only by default.- Kaggle source:
kaggle_3m/(Buda et al., TCGA-LGG). 110 patient subdirs with paired*.tif+*_mask.tif.
Docker
Dockerfileis multi-stage (base,training,serving);.dockerignorekeeps context minimal.- Published images live at
ghcr.io/kiselyovd/brain-mri-segmentation:<tag>. - Base image:
python:3.13-slim-bookworm.
Model weights
- Published to HF Hub at
kiselyovd/brain-mri-segmentation. Each release tag maps to an HF commit SHA. - Weights ship as
model.safetensors.
One-command reproduction
git clone https://github.com/kiselyovd/brain-mri-segmentation
cd brain-mri-segmentation
uv sync --all-groups
bash scripts/sync_data.sh "/path/to/Brain MRI segmentation/kaggle_3m"
uv run python -m brain_mri_segmentation.data.prepare --raw data/raw --out data/processed
uv run python -m brain_mri_segmentation.training.train +experiment=sota
uv run python -m brain_mri_segmentation.evaluation.evaluate --checkpoint artifacts/checkpoints/best.ckpt --out reports/metrics.json
Expected: the numbers in BENCHMARKS.md ± 1% (small test-set variance + floating-point noise).