MedSAM2 weights for MLX

Five MedSAM2 checkpoints for the sam2.1_hiera_t512 graph in medsam2-mlx: MedSAM2_latest, MedSAM2_2411, MedSAM2_CTLesion, MedSAM2_MRI_LiverLesion, and MedSAM2_US_Heart. Each is a float32 safetensors file.

Converted from wanglab/MedSAM2 revision e4a6f35edd7e091619cbc0750f462f1574e23955 without retraining. Original parameter names, shapes, and values are preserved. Credit Jun Ma, Zongxin Yang, Sumin Kim, Bihui Chen, Mohammed Baharoon, Adibvafa Fallahpour, Reza Asakereh, Hongwei Lyu, and Bo Wang for MedSAM2. Cite their paper.

Quick start

uv venv --python 3.13
source .venv/bin/activate

uv pip install "medsam2-mlx>=0.2.8"
uv tool install huggingface-hub

hf download MedMLX/medsam2-mlx --revision 841bcc529f95f33a6bbf11bc87e5be58d485cbc3 --local-dir models

Replace the example input paths with your own files.

from medsam2_mlx.medmlx import run

result = run(
    image_path='ct.nii.gz',
    weights_path='models/MedSAM2_latest.safetensors',
    output_dir='outputs',
    box_xyxy=[120, 140, 180, 200],
    frame_idx=40,
    propagation='both',
)
print(result["outputs"])

Pass any of the five checkpoint files as weights_path. The box and frame are examples; use a box around the target on one slice of your image.

The upstream model card identifies the weights as CC BY-SA 4.0 and states that they may only be used for research and education. See the license terms and upstream model card. Outputs require human review.

Citation

If you use MedMLX, please cite the MedMLX paper:

@article{sandoval2026medmlx,
  title   = {MedMLX: On-Device Medical Imaging AI for Apple Silicon},
  author  = {Sandoval, A. and Sandoval, J. and Saleem, A.},
  journal = {medRxiv},
  year    = {2026},
  doi     = {10.64898/2026.10.28.26366762}
}
Downloads last month

-

Downloads are not tracked for this model. How to track
MLX
Hardware compatibility
Log In to add your hardware

Quantized

Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for MedMLX/medsam2-mlx

Base model

wanglab/MedSAM2
Finetuned
(2)
this model

Collection including MedMLX/medsam2-mlx

Paper for MedMLX/medsam2-mlx