Downloads · 30 days
9
16% of all-time downloads
MohanadKombar/brain-tumor-unetr-brats
brain-tumor-unetr-brats is a machine learning model from MohanadKombar. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
This repository contains pre-trained weights, architecture definition, and standalone inference scripts for a UNETR (3D Vision Transformer) network trained for volumetric brain tumor segmentation on multi-modal MRI sc…
Downloads · 30 days
9
16% of all-time downloads
All-time downloads
58
Public
Repo size
77.4 MB
Likes
0
Public
Click a slice to open those files.
.bin77.4 MB · 100%
From the Hugging Face model README
This repository contains pre-trained weights, architecture definition, and standalone inference scripts for a UNETR (3D Vision Transformer) network trained for volumetric brain tumor segmentation on multi-modal MRI scans.
MohanadKombar/brain-tumor-unetr-bratsLayerNorm (Transformer) and GroupNorm (Decoder)T1, T1Gd, T2, FLAIR)| Dataset / Cohort | Mean Dice | ET Dice | TC Dice | WT Dice | Mean HD95 (mm) |
|---|---|---|---|---|---|
| BraTS Validation (391 cases) | 0.8362 | 0.7629 | 0.8277 | 0.9177 | 13.95 |
| UPenn-GBM Out-of-Distribution (30 cases) | 0.4749 ± 0.3007 | 0.4454 ± 0.3223 | 0.4976 ± 0.3387 | 0.4818 ± 0.2887 | 87.71 ± 27.26 |
pip install torch monai nibabel huggingface_hub
import torch
from inference import load_model, predict
# 1. Load pre-trained model from Hugging Face Hub (or local directory)
model, metadata = load_model("MohanadKombar/brain-tumor-unetr-brats")
# 2. Prepare 4-channel input volume of shape (1, 4, D, H, W)
# Input modalities must be ordered: [T1, T1Gd, T2, FLAIR]
dummy_input = torch.randn(1, 4, 128, 128, 128)
# 3. Run sliding-window inference
probabilities = predict(model, dummy_input) # Output shape: (1, 3, 128, 128, 128)
# 4. Threshold at 0.5 for binary segmentation masks
pred_binary = (probabilities > 0.5).cpu().numpy()[0] # [0: ET, 1: TC, 2: WT]
Inputs MUST be preprocessed prior to running inference to produce valid segmentations:
[0.5, 99.5] percentile range per modality.intensity > 0 across modalities).