MLX

SAM3 MLX Examples

Example scripts demonstrating how to use SAM3 MLX for segmentation tasks.

Click-Based Segmentation

Segment objects by clicking on them with positive/negative points.

Basic Usage

# Segment with a single positive click
python click_segment.py --image photo.jpg --point 512,384

# Segment with multiple points
python click_segment.py --image photo.jpg --point 512,384 --point 600,400

# Use positive (+) and negative (-) points for refinement
python click_segment.py --image photo.jpg --point +512,384 --point -100,100

# Save visualization
python click_segment.py --image photo.jpg --point 512,384 --output result.png

# Get single best mask instead of 3 masks
python click_segment.py --image photo.jpg --point 512,384 --single-mask

Requirements

pip install pillow matplotlib mlx

Performance

On Apple Silicon with MLX:

  • Model initialization: ~2-3s
  • Single inference: <200ms (target performance)
  • Multiple masks: 3 predictions per inference

Box-Based Segmentation

Coming soon: Segment using bounding box prompts.

Mask-Based Refinement

Coming soon: Refine existing masks with additional mask prompts.

Batch Processing

Coming soon: Process multiple images efficiently.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for Hoodrobot/MLX_SAM3

Base model

facebook/sam3
Finetuned
(11)
this model