<!-- # hard line break macro for HTML -->

<a id="model-zoo-segment-anything-3-image-torch"></a>

# segment-anything-3-image-torch

Open-vocabulary instance segmentation that finds and segments all objects matching a text concept like ‘person’ or ‘yellow school bus’.

**Details**

- Model name: `segment-anything-3-image-torch`
- Model source: [https://github.com/facebookresearch/sam3](https://github.com/facebookresearch/sam3)
- Model author: Nicolas Carion, Laura Gustafson, Yuan-Ting Hu, et al.
- Model license: SAM License
- Model size: 3.45 GB
- Exposes embeddings? no
- Tags: `segment-anything, torch, zero-shot, transformer, official`

**Requirements**

- Packages: `torch, torchvision, sam3`
- CPU support
  - yes
- GPU support
  - yes

**Example usage**

```python
import fiftyone as fo
import fiftyone.zoo as foz

dataset = foz.load_zoo_dataset(
    "coco-2017",
    split="validation",
    dataset_name=fo.get_default_dataset_name(),
    max_samples=50,
    shuffle=True,
)

# Concept mode: find and segment all objects matching a text prompt
model = foz.load_zoo_model(
    "segment-anything-3-image-torch",
    operation_mode="concept",
    classes=["person", "car", "dog"],
)
dataset.apply_model(model, label_field="segmentations_concept")

# Exemplar concept mode: find and segment object with text prompts and exemplar Detections
model = foz.load_zoo_model(
    "segment-anything-3-image-torch",
    operation_mode="concept",
    classes=["person"],
)
dataset.apply_model(
        model,
        label_field="segmentations_concept_with_exemplar",
        prompt_field="person_detections", # contains exemplar Detections with positive / negative labels
    )

# Visual mode: segment inside boxes or using keypoints
model = foz.load_zoo_model(
    "segment-anything-3-image-torch",
    operation_mode="visual",
)
dataset.apply_model(
    model,
    label_field="segmentations",
    prompt_field="ground_truth",  # can contain Detections or Keypoints
)

session = fo.launch_app(dataset)
```
