Views
No views yet
MohanadKombar/brain-tumor-unet3d-bratsGroupNorm (groups=4) — batch-size invariant[60, 120, 240, 480]T1, T1Gd, T2, FLAIR)| Dataset / Cohort | Mean Dice | ET Dice | TC Dice | WT Dice | Mean HD95 (mm) |
|---|---|---|---|---|---|
| BraTS Validation (391 cases) | 0.8694 | 0.8211 | 0.8576 | 0.9218 | 13.95 |
| UPenn-GBM Out-of-Distribution (30 cases) | 0.5186 ± 0.3223 | 0.5188 ± 0.3809 | 0.4855 ± 0.3658 | 0.5514 ± 0.2616 | 90.58 ± 31.52 |
pip install torch monai nibabel huggingface_hub1import torch
2from inference import load_model, predict
3
4# 1. Load pre-trained model from Hugging Face Hub (or local directory)
5model, metadata = load_model("MohanadKombar/brain-tumor-unet3d-brats")
6
7# 2. Prepare 4-channel input volume of shape (1, 4, D, H, W)
8# Input modalities must be ordered: [T1, T1Gd, T2, FLAIR]
9dummy_input = torch.randn(1, 4, 128, 128, 128)
10
11# 3. Run sliding-window inference
12probabilities = predict(model, dummy_input) # Output shape: (1, 3, 128, 128, 128)
13
14# 4. Threshold at 0.5 for binary segmentation masks
15pred_binary = (probabilities > 0.5).cpu().numpy()[0] # [0: ET, 1: TC, 2: WT][0.5, 99.5] percentile range per modality.intensity > 0 across modalities).