Metadata-Version: 2.4
Name: sam3_mlx
Version: 0.1.4
Summary: MLX port of Meta's Segment Anything 3 (SAM 3) for Apple Silicon.
Author: Alfredo Sandoval
License-Expression: LicenseRef-SAM AND MIT
Project-URL: Homepage, https://github.com/MedMLX/sam3-mlx
Project-URL: Repository, https://github.com/MedMLX/sam3-mlx
Project-URL: Issues, https://github.com/MedMLX/sam3-mlx/issues
Keywords: sam3,segment-anything,segmentation,mlx,apple-silicon,computer-vision
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Scientific/Engineering :: Image Recognition
Requires-Python: >=3.13
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: THIRD_PARTY_NOTICES.md
Requires-Dist: ftfy>=6.3.1
Requires-Dist: huggingface-hub>=1.1.6
Requires-Dist: medmlx-core==0.2.3
Requires-Dist: mlx<0.33,>=0.32.4
Requires-Dist: numpy>=2.3.5
Requires-Dist: pillow<14,>=13
Requires-Dist: regex>=2025.11.3
Provides-Extra: viz
Requires-Dist: matplotlib>=3.10.8; extra == "viz"
Provides-Extra: video
Requires-Dist: opencv-python-headless>=4.10.0; extra == "video"
Dynamic: license-file

# sam3-mlx

Segment images from text and geometric prompts with an unofficial native MLX port of SAM 3.

[Docs](https://github.com/MedMLX/sam3-mlx/blob/main/docs/usage.md) · [MedMLX](https://github.com/MedMLX)

![Text prompts “person” and “helmet” → masks on a real photograph.](https://raw.githubusercontent.com/MedMLX/sam3-mlx/main/docs/showcase.png)

*Text prompts “person” and “helmet” → masks on a real photograph.*

| Input | Output |
| :--- | :--- |
| Image + text, boxes or points | Masks, boxes and confidence scores |

**Apple Silicon · Metal · Python 3.13+** · [uv](https://docs.astral.sh/uv/)

## Quick start

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

uv pip install sam3-mlx
```

Weights download automatically; Hugging Face access to the official checkpoint is required.

```python
from sam3_mlx import build_sam3_image_model
from sam3_mlx.model.sam3_image_processor import Sam3Processor

model = build_sam3_image_model()
processor = Sam3Processor(model, resolution=1008)

state = processor.set_image("image.jpg")
state = processor.set_text_prompt("shoe", state)

masks, boxes, scores = state["masks"], state["boxes"], state["scores"]
```

Use a resolution divisible by 14. Selected-frame video runs each frame independently; temporal tracking and SAM 3.1 are experimental.

## License

SAM License; see [LICENSE](https://github.com/MedMLX/sam3-mlx/blob/main/LICENSE) and [third-party notices](https://github.com/MedMLX/sam3-mlx/blob/main/THIRD_PARTY_NOTICES.md). Unofficial port; not affiliated with Meta. Official checkpoints have separate access terms.

For research and education. Outputs require human review.
