| --- |
| 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. |