Instructions to use MedMLX/musclemap-mlx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use MedMLX/musclemap-mlx with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] hf download MedMLX/musclemap-mlx --local-dir musclemap-mlx
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Atomic Chat
MuscleMap v1.4 for MLX
Converted weights for musclemap-mlx, which segments 113 muscle and bone structures in 3D MRI and CT NIfTI images on Apple Silicon using MLX and Metal.
The 2D MONAI UNet has one input channel and 114 output channels. config.json
contains the publisher configuration, and labels.json preserves all original
anatomical IDs, names, sides and regions. Output IDs are anatomical IDs, not
consecutive channel indices.
Source and terms
MuscleMap v1.4 publisher checkpoint,
with source revision 35a2138.
The publisher licenses the checkpoint and configuration under MIT. The complete
license and attribution accompany this bundle in LICENSE and NOTICE.
Conversion preserves all 46 float32 tensors exactly; no training or quantization
was performed. conversion.json records their inventory and source revision.
Use
Install musclemap-mlx>=0.2.0 and run:
from musclemap_mlx import run
result = run(image_path="scan.nii.gz", output_dir="out")
print(result["outputs"]["mask"])
The weights download from this repository on first use. To use a local copy of this bundle, pass its folder as weights_path.
The package restores logits to the input grid before argmax, remaps channels to original anatomical IDs and retains the largest connected component per label. Chunk size affects normalization, matching upstream's independent chunk passes and source-header NIfTI round trip. Use the same chunk size for comparisons.
Qualification
With MONAI 1.3.2 and PyTorch 2.4.1 as the float32 reference, the native Metal
pipeline matched every final voxel on the complete TotalSegmentator compact CT
(122x101x30) and MRI (117x91x20) test volumes at source revision
d89e47f73d24f5fba732a715aeb6fdc0ae34526b. Both used eight-slice chunks and 90%
Gaussian overlap. Maximum restored-logit errors were 9.92e-5 and 1.03e-4,
respectively, within atol=5e-4, rtol=1e-5. These are implementation parity results
on two compact examples. They do not measure anatomical accuracy against manual
segmentations or coverage of every structure. Methods are in the package's
technical.md.
Cite McKay et al., MuscleMap: An Open-Source, Community-Supported Consortium for Whole-Body Quantitative MRI of Muscle, J Imaging 2024, 10(11):262, doi:10.3390/jimaging10110262.
- Downloads last month
- 76
Quantized