File size: 1,321 Bytes
e2caaaa ced11e2 e2caaaa | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | ---
license: apache-2.0
base_model:
- facebook/sam3
tags:
- 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
```bash
# 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
```bash
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. |