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

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

# segment-anything-3-video-torch

Open-vocabulary video segmentation that finds, segments, and tracks all objects matching a text concept across video frames.

**Details**

- Model name: `segment-anything-3-video-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, video, 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
from fiftyone import ViewField as F

dataset = foz.load_zoo_dataset("quickstart-video", max_samples=2)


# Concept mode: find and segment object with text prompts on selected frame, and track objects across frames
model = foz.load_zoo_model(
    "segment-anything-3-video-torch",
    classes=["person"],
    operation_mode="concept",
    propagation_direction="forward", # also supports backward and both
    text_frame_idx=1,
)
dataset.apply_model(model, label_field="segmentations_concept")

# Exemplar concept mode: text prompt + exemplar boxes on frame 10, propagate in both directions
model = foz.load_zoo_model(
    "segment-anything-3-video-torch",
    classes=["person"],
    operation_mode="concept",
    propagation_direction="both",
    prompt_frame_indices=[10],
)
dataset.apply_model(
    model,
    label_field="segmentations_concept_with_exemplar",
    prompt_field="frames.person_detections",  # exemplar Detections on frame 10
)

# Visual mode: segment inside boxes and propagate to all frames
model = foz.load_zoo_model("segment-anything-3-video-torch")
dataset.apply_model(
    model,
    label_field="segmentations",
    prompt_field="frames.detections",  # can contain Detections or Keypoints
    prompt_frame_indices=[1],
)

session = fo.launch_app(dataset)
```
