> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.ovalbee.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.ovalbee.com/_mcp/server.

# Serve live auto labeling with SAM 3

> Keeps SAM 3 resident for as long as the deployment is up, labeling images from the ones already labeled. Each submitted annotation becomes a visual prompt, and predictions are made by transferring the most similar of those prompts onto the new image. Nothing is trained: quality improves by submitting more labeled images. Holds the GPU for its whole lifetime.

Runs on: gpu  Dockerfile

> **Note**
>
> First run can take longer while the worker pulls the configured Docker image.

## Overview

Suggests labels for new images using examples you have already labeled. Every annotation submitted to the session
becomes a SAM 3 *visual prompt* — a concept captured from the geometry you drew — and a prediction
applies the concepts that look most like the target image to that image.

Nothing is trained. There is no optimizer, no loss and no checkpoint: the bank of captured
references *is* the model state. Fine-tuning can reuse the same labeled images. This session only improves when you give it more labeled images, but it does so
instantly — the first submitted image is usable as a reference the moment it is captured, where a
fine-tune needs hundreds of iterations before its suggestions are worth looking at.

Start this deployment from the Deployments page or place it on the canvas as a [deploy node](/concepts/deployments#deploy-nodes-in-a-flow). It holds one GPU for
its whole lifetime and accepts requests over HTTP from the labeling tool as images are submitted, or from
anything else that can call the routes below. On the canvas, its **Deployment** output feeds
[Simulate labeling with auto labeling](/node-library/nodes/models-general-simulate-labeling-with-auto-labeling)
and [Prelabel with auto labeling](/node-library/nodes/models-general-prelabel-with-auto-labeling).
Set **Labeling dataset** to the dataset a labeling step takes its images from, and only that
step's labelers are offered the session. For a session that trains on submitted examples, use
[Serve live training with Grounding DINO](/node-library/nodes/models-grounding-dino-serve-live-training-with-grounding-dino).

```mermaid
flowchart LR
  A[Annotator labels an image] --> B[POST /samples]
  B --> C[Concept bank]
  C --> D[POST /predict]
  D --> A
```

## Prerequisites

| Requirement                        | What you need                                                                                                                                                                                                                                                                                                                                 |
| ---------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| GPU worker                         | Choose a GPU machine class, or leave Auto to select one. SAM 3 holds the GPU for as long as the deployment runs; CPU classes are not supported.                                                                                                                                                                                               |
| Model                              | SAM3 copied from the catalog, or SAM3 weights of your own. The catalog's weights are OvalBee's copy of the authors' checkpoint, which comes with the text of the [SAM License](https://github.com/facebookresearch/sam3/blob/11dec2936de97f2857c1f76b66d982d5a001155d/LICENSE) it is distributed under, so no Hugging Face account is needed. |
| A client that calls the deployment | The labeling tool, a script over HTTP, or Simulate labeling with auto labeling and Prelabel with auto labeling in a flow.                                                                                                                                                                                                                     |
| Labeled images in a dataset        | Every image submitted is read back from the workspace, so its annotation has to be saved before the id is sent.                                                                                                                                                                                                                               |
| Masks, polygons or boxes           | Masks and polygons make the best concepts because points can be sampled from them. Rectangles work, with the box as the only geometric channel.                                                                                                                                                                                               |

## How it works

Fetches the model's weights - the catalog's from OvalBee's copy, checked against a pinned
SHA-256 - and loads SAM 3 with them onto the deployment's GPU.

Takes labeled images on `POST /samples`. Each one is downloaded, its newest annotation is read,
and one concept per class drawn on it is captured: the class name as the text channel, each
object's bounding box, and points sampled from its mask where the mask shows occlusion. What
the session predicted on that image and the labeler removed is captured as negative boxes for
its class, which pushes the concept away from that mistake. A class nobody had drawn yet is appended
to the vocabulary.

Banks every submitted image as a reference, alongside a cheap descriptor of what it looks like.
Submitting an image again replaces the reference it contributed before, so a correction
replaces the thing it corrects rather than competing with it.

Answers `POST /predict` by running the backbone once on the target, then, per class, merging
the `retrieval_k` most visually similar references into one concept and applying it. Only the
grounding head re-runs per class, so a large vocabulary costs far less than one pass each.

Splits large images into windows when their objects would be too small to find. SAM 3 sees
every image scaled to 1008 x 1008 pixels, and objects that end up under about 32 pixels
there are mostly missed. With `tiling` on, the references retrieved for the target say how
large its objects are relative to the image, the smallest of them counting; when one would come out under about 48
pixels, the target is predicted in overlapping windows sized to bring it there, at most 25,
and each submitted image is captured from one such window, the one holding the most of its
objects. Sizes are read relative to the image, so a dataset mixing close-ups and wide shots
tiles only the images whose references show small objects. An image that is already small enough
is predicted whole, as before. Each window costs one backbone pass, and each is another chance
for a false box, so a windowed image keeps only detections at `tile_confidence_threshold` or
above, or the request's own threshold if that is higher.

Resolves detections that claim the same object across classes by keeping the highest scoring
one, comparing masks rather than boxes so two overlapping objects of different classes both
survive. With `drop_nested_boxes` on, a box that lies alone inside a larger box of its class
is dropped as a part of that object; a larger box holding two or more boxes is a group, and
its inner boxes stay. Answers in masks or boxes as `output_geometry` asks.

## FAQ

#### How do I call the deployment?

Every endpoint is reached through the deployment's own invoke URL, which the Deployments page
shows on the deployment's info dialog. `GET /status` reports the phase, how many labeled images
the session holds, how many references are banked per class, and the vocabulary.

#### Can it predict before anything has been labeled?

No. Unlike a text-prompted detector, a concept cannot exist before something has been drawn —
`classes` in Config only decides which class names the session will accept, not what they look
like. `POST /predict` answers 400 until `initial_samples` labeled images have arrived.

#### What happens if I submit the same image twice?

Its reference is replaced by the newer one. Correcting an image is therefore worth doing: the
session prompts from the corrected geometry, not from both versions.

#### Why did adding more labeled images not change anything?

Only `retrieval_k` references are used per prediction, chosen by visual similarity to the
target. A new reference changes a prediction when it is among the closest to that image, which
is what makes the bank scale — adding the hundredth image of the same scene changes little,
adding the first image of a new one changes a lot.

#### Masks or boxes?

`output_geometry: instance_segmentation` returns SAM 3's own per-detection mask, and
`object_detection` returns that mask's bounding box. The work is identical either way — SAM 3
computes the mask regardless — so the choice is only about what the caller wants. Set it to
`object_detection` when the dataset is a detection dataset, so what the session writes back
is the geometry the rest of the flow expects.

The box is taken from the mask rather than from SAM 3's own detection head. The two disagree
by a few pixels, and the head's box can cut off part of the object the same prediction
segmented, so the mask is the one both geometries are derived from.

#### Does stopping the deployment lose anything?

All of it. The concept bank lives in the container's memory and there is no checkpoint to write
it to, so a restarted deployment starts empty and the images have to be submitted again.

#### What does this node not support?

One GPU and one session per deployment. It produces no model version, because nothing is
trained — to end up with weights, label with this session and then run a training node over the
result. It reports no quality metric, because nothing is held out.

## Inputs

**`Model`** `model` — required

SAM 3 weights the session labels with: SAM3 from the catalog, OvalBee's copy of its authors' weights, or weights of your own. With the safe-weights policy on, only safetensors load. Key: `MODEL`.

---

**`Labeling dataset`** `dataset`

The dataset a labeling step takes its images from - the labeling pool whose labeled images become this session's prompts. Set it, and the labeling tool offers this session only to labeling steps drawing from that dataset, so labelers of another flow neither see it nor send it their images. Empty, every labeling step in the workspace is offered it. Key: `LABELING_DATASET`.

---

**`Config`** `yaml` — required

YAML settings for what the session outputs and how it builds and applies concepts. classes lists the class names the session starts with, every class drawn on a submitted image is appended to it. Nothing is predicted until initial_samples labeled images have been submitted, since a class has no concept before something of it has been drawn. output_geometry chooses whether predictions come back as masks or as boxes. SAM 3 sees every image scaled to about 1000 pixels, so with tiling on, an image whose objects would shrink below what it can find - judged by the size of the objects on the submitted images - is predicted in overlapping windows, and the labeled images are taken in at the same scale. A windowed image keeps only detections at tile_confidence_threshold or above, since every window is another chance for a false box. drop_nested_boxes removes a box lying alone inside a larger box of its class - SAM 3 boxing part of an object it also boxed whole. The prompt channels and point counts are baked into concepts as they are captured, so changing them only affects images submitted afterwards. Key: `CONFIG`.

---

## Outputs

**`Deployment`** `deployment`

The running session. Wire it into a node that takes an auto labeling session to submit labeled images to it or to pre-label a dataset with it while it is up. Key: `DEPLOYMENT`.

---

## Models and configuration

**Model** is the SAM 3 the session labels with: SAM3 copied from the catalog, whose weights the
deployment downloads from OvalBee's copy when it starts, through the workspace's model cache when
the worker has one, or SAM3 weights of your own. With the safe-weights policy on, only safetensors
load; a `.pt` checkpoint, the catalog's included, has to be converted first.

Config splits into four groups. `classes` and `initial_samples` decide what the session will accept
and when it will answer. `output_geometry` and `confidence_threshold` decide what comes back, and
`confidence_threshold` is the only key a single `/predict` call may override, through `settings`.

The prompt channels — `use_text_prompt`, `use_box_prompt`, `use_point_prompt`, `adaptive_points`,
`occlusion_threshold` and the `n_*_points` counts — decide how a concept is built. They are baked
into each reference as it is captured, so changing them only affects images submitted afterwards.
To re-capture the existing bank under new settings, submit those images again. At least one of
`use_text_prompt` or `use_box_prompt` must stay on, since SAM 3 cannot build a concept without a
text or box channel.

`retrieval_k` and `conflict_iou_threshold` decide how concepts are applied: how many references are
merged per class, and how much mask overlap makes two detections the same object. The same overlap
merges an object two neighbouring windows both see whole; a detection cut by a window edge is
dropped when another window holds the object whole.

## Runtime

Runs on the `node-sam3-live` image, which is the `Serve SAM3` image plus a patch that lets a concept
captured on one image be applied to another — vanilla SAM 3 can only ground a prompt against the
image the prompt was drawn on. The build fails rather than the first request if that patch does not
apply. The image carries no weights.

The deployment serves on the platform's standard service port and reports 503 on its health
endpoint until SAM 3 is on the device, so it is not routed traffic it cannot answer. Submissions and
predictions share one GPU under a lock, taken per image rather than per request, so a submission
arriving during a large prediction batch waits for one image rather than all of them.

## JSON config

Machine-readable node interface for automation and advanced usage.

#### Show JSON

```json
{
  "name": "Serve live auto labeling with SAM 3",
  "description": "Keeps SAM 3 resident for as long as the deployment is up, labeling images from the ones already labeled. Each submitted annotation becomes a visual prompt, and predictions are made by transferring the most similar of those prompts onto the new image. Nothing is trained: quality improves by submitting more labeled images. Holds the GPU for its whole lifetime.",
  "category": "Models",
  "namespace": "ovalbee",
  "templateKey": "models/sam3/serve_live_auto_labeling_with_sam_3",
  "version": "v1",
  "inputs": [
    {
      "key": "MODEL",
      "label": "Model",
      "type": "model",
      "description": "SAM 3 weights the session labels with: SAM3 from the catalog, OvalBee's copy of its authors' weights, or weights of your own. With the safe-weights policy on, only safetensors load.\n",
      "required": true,
      "default": null,
      "visibleWhen": null,
      "options": {
        "framework": "sam3",
        "task_type": "instance_segmentation"
      }
    },
    {
      "key": "LABELING_DATASET",
      "label": "Labeling dataset",
      "type": "dataset",
      "description": "The dataset a labeling step takes its images from - the labeling pool whose labeled images become this session's prompts. Set it, and the labeling tool offers this session only to labeling steps drawing from that dataset, so labelers of another flow neither see it nor send it their images. Empty, every labeling step in the workspace is offered it.\n",
      "required": false,
      "default": null,
      "visibleWhen": null,
      "options": {
        "creatable": false
      }
    },
    {
      "key": "CONFIG",
      "label": "Config",
      "type": "yaml",
      "description": "YAML settings for what the session outputs and how it builds and applies concepts. classes lists the class names the session starts with; every class drawn on a submitted image is appended to it. Nothing is predicted until initial_samples labeled images have been submitted, since a class has no concept before something of it has been drawn. output_geometry chooses whether predictions come back as masks or as boxes. SAM 3 sees every image scaled to about 1000 pixels, so with tiling on, an image whose objects would shrink below what it can find - judged by the size of the objects on the submitted images - is predicted in overlapping windows, and the labeled images are taken in at the same scale. A windowed image keeps only detections at tile_confidence_threshold or above, since every window is another chance for a false box. drop_nested_boxes removes a box lying alone inside a larger box of its class - SAM 3 boxing part of an object it also boxed whole. The prompt channels and point counts are baked into concepts as they are captured, so changing them only affects images submitted afterwards.\n",
      "required": true,
      "default": "# --- Vocabulary ---\nclasses: []         # class names the session starts with; submitted images add more\n# --- Output ---\noutput_geometry: instance_segmentation  # or object_detection for the masks' bounding boxes\nconfidence_threshold: 0.7\n# --- Schedule ---\ninitial_samples: 1  # labeled images required before the session will predict\n# --- Reference retrieval ---\nretrieval_k: 2      # most visually similar references merged into one concept per class\nensemble_refs: false  # one prediction per reference, fused by agreement, instead of merging them\n# --- Prompt channels ---\nuse_text_prompt: true   # anchor the concept with the class name\nuse_box_prompt: true    # anchor it with each reference object's bounding box\nuse_point_prompt: true  # points sampled from the reference masks\nadaptive_points: true   # add points only where the masks show occlusion\nocclusion_threshold: 0.15  # occluded fraction above which a reference gets points\nn_pos_points: 3     # points sampled inside each reference object\nn_neg_points: 3     # points sampled on each occluder\nn_bg_neg_points: 0  # extra negatives from in-box background\n# --- Overlap resolution ---\nconflict_iou_threshold: 0.7  # mask IoU above which two detections are the same object\n# --- Large images ---\ntiling: true  # predict in windows where the references' objects would be too small to find\ntile_confidence_threshold: 0.8  # lowest confidence kept on an image predicted in windows\ndrop_nested_boxes: true  # drop a box that is the only box inside a larger one of its class\n",
      "visibleWhen": null
    }
  ],
  "outputs": [
    {
      "key": "DEPLOYMENT",
      "label": "Deployment",
      "type": "deployment",
      "description": "The running session. Wire it into a node that takes an auto labeling session to submit labeled images to it or to pre-label a dataset with it while it is up.\n",
      "artifact": false,
      "badge": false,
      "badgeOpens": null,
      "hidden": false
    }
  ],
  "runtime": {
    "type": "docker",
    "devices": [
      "gpu"
    ],
    "dockerImage": "ovalbee/node-sam3-live:0.0.7"
  }
}
```

## References

#### Sources and related pages

* [Serve SAM3](/node-library/nodes/models-sam-3-serve-sam-3) — the same weights served for the labeling tool's Smart Tool, one object at a time.
* [Serve live training with Grounding DINO](/node-library/nodes/models-grounding-dino-serve-live-training-with-grounding-dino) — a live session that fine-tunes instead of prompting.
* [SAM 3](https://github.com/facebookresearch/sam3) — upstream model and weights, `facebook/sam3`.