Image Segmentation
MLX
English
native-mlx
apple-silicon
medical-imaging
mri
ct
brain
head
segmentation
nnunet
research
Instructions to use MedMLX/siam with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use MedMLX/siam with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] hf download MedMLX/siam --local-dir siam
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Atomic Chat
|
Download README.md from MedMLX/siam: direct link, hf CLI and curl.
- Browser
- Download file 6 kB
-
https://huggingface.co/MedMLX/siam/resolve/main/README.md
- Command line
-
hf download hf://MedMLX/siam/README.md
-
curl -L -o README.md https://huggingface.co/MedMLX/siam/resolve/main/README.md
6 kB
| license: cc-by-4.0 | |
| library_name: mlx | |
| tags: | |
| - mlx | |
| - native-mlx | |
| - apple-silicon | |
| - medical-imaging | |
| - mri | |
| - ct | |
| - brain | |
| - head | |
| - segmentation | |
| - nnunet | |
| - research | |
| language: | |
| - en | |
| inference: false | |
| pipeline_tag: image-segmentation | |
| # SIAM 路 Head tissue segmentation | |
| Segment brain and head tissues from any 3D head MRI or CT with SIAM v0.3, locally on Apple Silicon. | |
| > **SIAM is the work of Romain Valabregue and co-authors.** The model, its training method and the weights are theirs: see the original repository, [github.com/romainVala/SIAM](https://github.com/romainVala/SIAM), and the paper, [arXiv:2605.02737](https://arxiv.org/abs/2605.02737). This repository only repackages their released weights ([Zenodo 17733431](https://zenodo.org/records/17733431)) for MLX on Apple Silicon. Please cite their paper and star their repository if SIAM is useful to you. | |
| [Original SIAM repository](https://github.com/romainVala/SIAM) 路 [SIAM paper](https://arxiv.org/abs/2605.02737) 路 [Original weights](https://zenodo.org/records/17733431) 路 [nnunet-mlx runtime](https://github.com/MedMLX/nnunet-mlx) 路 [Files](https://huggingface.co/MedMLX/siam/tree/main) | |
| <img src="https://huggingface.co/MedMLX/siam/resolve/main/showcase.png" alt="SIAM segmentations of a full-head T1 MRI and of a glioma case in T1, contrast-enhanced T1, T2 and FLAIR" width="100%"> | |
| <sub>SIAM v0.3 segmentations produced by this MLX port (five-fold ensemble); the 3D view is a cutaway of the predicted label surfaces. Left: full-head T1 from [OpenNeuro ds000001](https://openneuro.org/datasets/ds000001), sub-01 (CC0, defaced). Right: glioma case 100 from Bartnik et al., [Zenodo 22205631](https://doi.org/10.5281/zenodo.22205631) (CC-BY-4.0, skull-stripped), the same model applied to each contrast.</sub> | |
| | Input | Output | | |
| | :--- | :--- | | |
| | One 3D head volume (T1, T2, FLAIR, CT, ...) 路 NIfTI | 17 tissue labels and an anomaly label | | |
| **Apple Silicon 路 Metal 路 Python 3.13** | |
| [SIAM](https://github.com/romainVala/SIAM) (Segment It All Model) by Valabregue et al. is an nnU-Net residual-encoder network trained on synthetic images generated from a few high-quality head templates, so it does not depend on the input contrast. Version 0.3 adds an `Anomalies` label for pathology. It predicts at 0.75 mm isotropic and returns labels on the input grid. | |
| ## Quick start | |
| ```bash | |
| uv venv --python 3.13 | |
| source .venv/bin/activate | |
| uv pip install "nnunet-mlx>=0.7.1" | |
| ``` | |
| ```python | |
| from nnunet_mlx.named_models import siam | |
| result = siam(image_path="head.nii.gz", output_dir="outputs") | |
| print(result["outputs"]["mask"]) | |
| ``` | |
| Without `weights_path`, the runner downloads this repository into the shared MedMLX cache on first use. `voxel_size=` reproduces SIAM's `-voxelsize` option for small heads, such as newborns; `fold=` selects one fold instead of the ensemble. | |
| The runner follows the inference of the original [`siam-pred -m 0`](https://github.com/romainVala/SIAM): the volume is reoriented to RAS voxel order without interpolation, all folds are ensembled with Gaussian sliding windows at a 0.5 step and no mirroring, and the label map is reoriented back exactly onto the input grid. | |
| ## Labels | |
| | Value | Label | Value | Label | | |
| | ---: | :--- | ---: | :--- | | |
| | 1 | GM (cortical grey matter) | 10 | Accu (accumbens) | | |
| | 2 | WM | 11 | Amyg (amygdala) | | |
| | 3 | CSF | 12 | Hippo (hippocampus) | | |
| | 4 | CSFv (ventricles) | 13 | Dura | | |
| | 5 | cerGM (cerebellar grey matter) | 14 | vascular | | |
| | 6 | Thal (thalamus) | 15 | Skull | | |
| | 7 | Pal (pallidum) | 16 | Head (extracranial soft tissue) | | |
| | 8 | Put (putamen) | 17 | Anomalies | | |
| | 9 | Caud (caudate) | | | | |
| ## Conversion | |
| Converted from the five-fold release on [Zenodo 17733431](https://zenodo.org/records/17733431) (`pred_DS108_LcsfP_Ano`, trainer `nnUNetTrainerNoDA`, `3d_fullres`, epoch 4000). Network weights are stored as float32 safetensors; no retraining, pruning or quantization. Optimizer state and the duplicate decoder aliases of encoder weights are not carried over. To reproduce from the original release: | |
| ```bash | |
| uv pip install "nnunet-mlx[convert]" | |
| nnunet-mlx convert pred_DS108_LcsfP_Ano siam | |
| ``` | |
| Checked against PyTorch nnU-Net 2.8.1 (CPU, float32) running the same inference as `siam-pred`: all five folds, 0.5-step Gaussian sliding windows, no mirroring. On a full-head T1 MRI, 99.995% of voxels receive the same label, every label has a Dice of at least 0.9996 except `Anomalies` (0.998, under 0.5 mL in that healthy head), and class probabilities differ by at most 0.004. On fold 0, a skull-stripped glioma T1 in LPS orientation, which exercises the reorientation path, gives 99.990% voxel agreement with a minimum Dice of 0.9995. | |
| A typical head MRI needs about 16 GB of unified memory; memory grows with the field of view. | |
| ## Use & license | |
| For research and education. Not validated for clinical use. | |
| Weights: [CC-BY-4.0](https://creativecommons.org/licenses/by/4.0/), as released by the SIAM authors. Credit Valabregue et al. and cite the SIAM paper when you use these weights. Upstream code: [Apache-2.0](https://github.com/romainVala/SIAM/blob/main/LICENSE). | |
| ## Paper references | |
| - [SIAM: Head and Brain MRI Segmentation from Few High-Quality Templates via Synthetic Training](https://arxiv.org/abs/2605.02737). | |
| - [Framework: nnU-Net: a self-configuring method for deep learning-based biomedical image segmentation](https://arxiv.org/abs/1809.10486). | |
| ## Citation | |
| Please cite SIAM: | |
| > Valabregue, R., Khemir, I., Bardinet, E., Rousseau, F., Auzias, G. & Dorent, R. (2026). SIAM: Head and Brain MRI Segmentation from Few High-Quality Templates via Synthetic Training. arXiv:2605.02737. | |
| If you use MedMLX, please cite the [MedMLX paper](https://doi.org/10.64898/2026.10.28.26366762): | |
| ```bibtex | |
| @article{sandoval2026medmlx, | |
| title = {MedMLX: On-Device Medical Imaging AI for Apple Silicon}, | |
| author = {Sandoval, J. and Sandoval, A. and Saleem, A.}, | |
| journal = {medRxiv}, | |
| year = {2026}, | |
| doi = {10.64898/2026.10.28.26366762} | |
| } | |
| ``` | |