SAM 3 Image Segmentation with OpenVINO
SAM 3 is Meta's unified vision-language model that supports: - Text-prompted segmentation: Segment objects by describing them in natural language - Box-prompted segmentation: Use bounding boxes as visual prompts (positive/negative) - Combined pro
Content
SAM 3 Image Segmentation with OpenVINO
SAM 3 is Meta's unified vision-language model that supports:
- Text-prompted segmentation: Segment objects by describing them in natural language
- Box-prompted segmentation: Use bounding boxes as visual prompts (positive/negative)
- Combined prompts: Text + negative boxes to exclude regions
- Point-prompted segmentation (SAM1 task): Click foreground/background points
- Video object tracking (SAM2 task): Track objects across video frames
This notebook demonstrates how to convert SAM 3 models to OpenVINO IR format and run inference using OpenVINO, aligned with the official examples on HuggingFace.
The model is decomposed into multiple sub-models for efficient conversion:
- Image Encoder — ViT backbone with FPN neck
- Text Encoder — Text transformer for language understanding
- Transformer Encoder — Multi-level feature fusion with text cross-attention
- Transformer Decoder — Object query decoding with box refinement
- Scoring — Dot-product scoring + final box prediction
- Segmentation Head — Pixel decoder + mask prediction
- Geometry Projections — Box embedding projections (Linear/Conv2d/Embedding, no control flow)
- Geometry Cross-Attention — CLS token + cross-attention encoder (no control flow)
- SAM1 Feature Prep — conv_s0/s1 + no_mem_embed for SAM1 task features
- SAM2 Prompt Encoder — Point/box prompt encoding (for SAM1/Tracker task)
- SAM2 Mask Decoder — Mask prediction from prompts (for SAM1/Tracker task)
Notebook Contents
This notebook shows an example of how to convert and use SAM3 using OpenVINO
Notebook contains the following steps:
- Convert PyTorch models to OpenVINO format.
- Run OpenVINO model in interactive segmentation mode.
⚠️ EXPERIMENTAL NOTEBOOK
This notebook demonstrates a model that has not been fully validated with OpenVINO. It may be fully supported and validated in the future.
Source and license
- Source
- Intel OpenVINO Notebooks
- Original
- openvinotoolkit/openvino_notebooks/notebooks/sam3
- License
- Apache-2.0