Aller au contenu
ModelPrésentéExterne
Télécharger

Sam2.1 Mlx

MLX-format weights for SAM2.1 (Segment Anything Model 2.1) ported to Apple MLX.

TypeOtherVersionRevision 1b7b988CClasse

Source du modèle

Type
Other
Taille du fichier
176–308 MB
Version
vRevision 1b7b988
Mis à jour
16 sept. 2026
Téléchargements
0
Source
Hugging Face

Description de la source

SAM2.1 MLX Weights

MLX-format weights for SAM2.1 (Segment Anything Model 2.1) ported to Apple MLX.

Quick Start

1. Clone the code:

git clone https://github.com/eisneim/sam2.1_mlx.git
cd sam2.1_mlx
pip install mlx opencv-python safetensors numpy

2. Download weights from this repo:

# Base Plus (recommended, best quality/speed balance)
huggingface-cli download eisneim/sam2.1_mlx_weights sam2.1_hiera_base_plus.safetensors --local-dir weights/

# Small (faster, slightly lower quality)
huggingface-cli download eisneim/sam2.1_mlx_weights sam2.1_hiera_small.safetensors --local-dir weights/

Or manually download the .safetensors files and place them in weights/.

3. Run:

# Video tracking — click on an object in the first frame
python inference_video.py -i your_video.mp4

# Image segmentation — click on an object
python inference_image.py -i your_image.jpg

# Use the small model
python inference_video.py -i your_video.mp4 --model small

Available Models

ModelFileSizeQualitySpeed
base_plussam2.1_hiera_base_plus.safetensors~300MBBest~130 fps
smallsam2.1_hiera_small.safetensors~150MBGood~200 fps

Converting Weights Yourself

If you prefer to convert from the original PyTorch checkpoints:

# Download PyTorch weights from Meta
wget https://dl.fbaipublicfiles.com/segment_anything_2/092824/sam2.1_hiera_base_plus.pt -P weights/

# Convert to MLX safetensors
python -m src.sam2.convert --src weights/sam2.1_hiera_base_plus.pt --dst weights/sam2.1_hiera_base_plus.safetensors

Links

License

Apache 2.0 (same as the original SAM2).

Sources

1 source
Hugging FacePrincipalVersion 1b7b98828e383e3d64025b615aff049b1face026
huggingface.co/eisneim/sam2.1_mlx/tree/1b7b98828e383e3d64025b615aff049b1face026

Vérifié 1 sept.

Artefacts du modèle

2 artefacts

sam2.1_hiera_base_plus.safetensors

safetensors · 308 MB · SHA-256 80d5c62aa0a6…a232 · Hugging Face

Télécharger

sam2.1_hiera_small.safetensors

safetensors · 176 MB · SHA-256 0b3a0198309a…3eef · Hugging Face

Télécharger

Extraits de sources

2 extraits

--- language: - en pipeline_tag: image-segmentation tags: - sam2 - segment-anything - mlx - apple-silicon - video-segmentation - object-tracking license: apache-2.0 --- # SAM2.1 MLX Weights MLX-format weights for [SAM2.1 (Segment Anything Model 2.1)](https://github.com/facebookresearch/sam2) ported to Apple MLX. ## Quick Start **1. Clone the code:** ```bash git clone https://github.com/eisneim/sam2.1_mlx.git cd sam2.1_mlx pip install mlx opencv-python safetensors numpy ``` **2. Download weights from this repo:** ```bash # Base Plus (recommended, best quality/speed balance) huggingface-cli download eisneim/sam2.1_mlx_weights sam2.1_hiera_base_plus.safetensors --local-dir weights/ # Small (faster, slightly lower quality) huggingface-cli download eisneim/sam2.1_mlx_weights sam2.1_hiera_small.safetensors --local-dir weights/ ``` Or manually download the `.safetensors` files and place them in `weights/`. **3. Run:** ```bash # Video tracking — click on an object in the first frame python inference_video.py -i your_video.mp4 # Image segmentation — click on an object python inference_image.py -i your_image.jpg # Use the small model python inference_video.py -i your_video.mp4 --model small ``` ## Available Models | Model | File | Size | Quality | Speed | |-------|------|------|---------|-------| | base_plus | `sam2.1_hiera_base_plus.safetensors` | ~300MB | Best | ~130 fps | | small | `sam2.1_hiera_small.safetensors` | ~150MB | Good | ~200 fps | ## Converting Weights Yourself If you prefer to convert from the original PyTorch checkpoints: ```bash # Download PyTorch weights from Meta wget https://dl.fbaipublicfiles.com/segment_anything_2/092824/sam2.1_hiera_base_plus.pt -P weights/ # Convert to MLX safetensors python -m src.sam2.convert --src weights/sam2.1_hiera_base_plus.pt --dst weights/sam2.1_hiera_base_plus.safetensors ``` ## Links - **Code:** https://github.com/eisneim/sam2.1_mlx - **Original SAM2:** https://github.com/facebookresearch/sam2 ## License Apache 2.0 (same as the original SAM2).

Source context: 0 downloads · 0 likes · Pipeline image-segmentation · Library sam2 · Repo eisneim/sam2.1_mlx