Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: other
|
| 3 |
+
extra_gated_fields:
|
| 4 |
+
First Name: text
|
| 5 |
+
Last Name: text
|
| 6 |
+
Date of birth: date_picker
|
| 7 |
+
Country: country
|
| 8 |
+
Affiliation: text
|
| 9 |
+
Job title:
|
| 10 |
+
type: select
|
| 11 |
+
options:
|
| 12 |
+
- Student
|
| 13 |
+
- Research Graduate
|
| 14 |
+
- AI researcher
|
| 15 |
+
- AI developer/engineer
|
| 16 |
+
- Reporter
|
| 17 |
+
- Other
|
| 18 |
+
geo: ip_location
|
| 19 |
+
By clicking Submit below I accept the terms of the license and acknowledge that the information I provide will be collected stored processed and shared in accordance with the Meta Privacy Policy: checkbox
|
| 20 |
+
extra_gated_description: >-
|
| 21 |
+
The information you provide will be collected, stored, processed and shared in
|
| 22 |
+
accordance with the [Meta Privacy Policy](https://www.facebook.com/privacy/policy/).
|
| 23 |
+
extra_gated_button_content: Submit
|
| 24 |
+
language:
|
| 25 |
+
- en
|
| 26 |
+
pipeline_tag: mask-generation
|
| 27 |
+
library_name: transformers
|
| 28 |
+
tags:
|
| 29 |
+
- sam3
|
| 30 |
+
---
|
| 31 |
+
|
| 32 |
+
# SAM 3
|
| 33 |
+
|
| 34 |
+
This repository mirrors the official **Segment Anything Model 3 (SAM 3)** weights released by Meta Superintelligence Labs. SAM 3 is a unified foundation model for prompt-driven segmentation in images and videos. It supports open-vocabulary text prompts and visual prompts (points/boxes/masks). Compared to SAM 2, SAM 3 exhaustively segments each instance of a requested concept and reaches ~75–80% of human-level performance on the SA-CO benchmark (270K unique concepts).
|
| 35 |
+
|
| 36 |
+
## Highlights
|
| 37 |
+
- **Presence token** improves discrimination between closely related prompts.
|
| 38 |
+
- **Decoupled detector + tracker** scales better for long video sequences.
|
| 39 |
+
- **4M+ automatically annotated concepts** ensure broad coverage of open-world categories.
|
| 40 |
+
|
| 41 |
+
> Original paper: *SAM 3: Segment Anything with Concepts* (Meta AI, 2024).
|
| 42 |
+
> Resources: [Project Page](https://ai.meta.com/sam3) · [Demo](https://segment-anything.com/)
|
| 43 |
+
|
| 44 |
+
## Files Included
|
| 45 |
+
- `sam3.safetensors` — detector and tracker weights for image + video segmentation.
|
| 46 |
+
- Tokenizer/config assets should be copied from the official `facebookresearch/sam3` repository; this mirror only repackages the safetensors weights for self-hosting.
|
| 47 |
+
|
| 48 |
+
## Quickstart
|
| 49 |
+
```bash
|
| 50 |
+
pip install torch==2.7.0 torchvision torchaudio --index-url https://download.pytorch.org/whl/cu126
|
| 51 |
+
pip install git+https://github.com/facebookresearch/sam3.git
|
| 52 |
+
|
| 53 |
+
python - <<'PY'
|
| 54 |
+
from sam3 import build_sam3_image_model
|
| 55 |
+
from sam3.model.sam3_image_processor import Sam3Processor
|
| 56 |
+
model = build_sam3_image_model(
|
| 57 |
+
bpe_path="sam3/assets/bpe_simple_vocab_16e6.txt.gz",
|
| 58 |
+
device="cuda",
|
| 59 |
+
eval_mode=True,
|
| 60 |
+
checkpoint_path="sam3.safetensors",
|
| 61 |
+
load_from_HF=False,
|
| 62 |
+
)
|
| 63 |
+
processor = Sam3Processor(model, device="cuda")
|
| 64 |
+
state = processor.set_image("your_image.jpg")
|
| 65 |
+
state = processor.set_text_prompt("white bicycle", state)
|
| 66 |
+
print(state["masks"].shape)
|
| 67 |
+
PY
|
| 68 |
+
```
|
| 69 |
+
|
| 70 |
+
## Integration Notes
|
| 71 |
+
These mirrored weights are used in the **AILab SAM3 ComfyUI node** (RMBG edition) to enable promptable segmentation workflows directly inside ComfyUI. The node loads `sam3.safetensors`, tokenizer assets, and the SAM3 processors locally, so the entire pipeline stays compatible even when offline.
|
| 72 |
+
|
| 73 |
+
## License & Usage
|
| 74 |
+
- This mirror preserves Meta's original weights and is subject to the license on [facebook/sam3](https://huggingface.co/facebook/sam3). You must accept Meta's terms before downloading the official release.
|
| 75 |
+
- When hosting this file in your own Hugging Face repository, keep this notice and credit the original authors.
|
| 76 |
+
- Cite the SAM 3 paper for any research or product that builds upon these weights.
|
| 77 |
+
|