> 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 training with Grounding DINO

> Keeps a Grounding DINO fine-tune running for as long as the deployment is up, learning from labeled images as they are submitted and answering prediction requests from the model being trained. Holds its machine for its whole lifetime. A machine without a GPU is only usable for a smoke test - one training iteration takes minutes there.

> **Note**
>
> A professional node, available with the Pro plan on OvalBee Cloud and with the Business plan on a self-hosted installation. On any plan you can add it to a flow and explore its settings; running it takes one of those plans.

Runs on: gpu, cpu

## Overview

Trains a Grounding DINO detector continuously while people are still labeling, and predicts with
it at the same time. Submit an image the moment it is labeled and the detector learns from it
within a couple of iterations, so the boxes it suggests on the next image come from a model that
has already seen the corrections made on the last one.

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. Reach for it when the wait between a label and its
effect on the suggestions is what you are trying to remove. For a fine-tune with a fixed budget
that ends, use [Train Grounding DINO](/node-library/nodes/models-grounding-dino-train-grounding-dino).

```mermaid
flowchart LR
  A[Annotator labels an image] --> B[POST /samples]
  B --> C[Background fine-tune]
  C --> D[POST /predict]
  D --> A
  C --> E[Model version]
```

## Prerequisites

| Requirement                            | What you need                                                                                                                                                  |
| -------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Machine with a GPU                     | The fine-tune and the predictions share one GPU for as long as the deployment runs. A machine class without a GPU is accepted, but only good for a smoke test. |
| Grounding DINO model in this workspace | The Model input only offers this workspace's own models. Copy a Grounding DINO entry from the zoo to get one.                                                  |
| A client that calls the deployment     | Nothing in the flow editor drives this node. Its endpoints are called over HTTP, from a script or from a labeling integration.                                 |
| Labeled images in a dataset            | Every image submitted for training is read back from the workspace, so its annotation has to be saved before the id is sent.                                   |

## How it works

Loads the weights the Model input names. A version with no weights of its own starts from the
public checkpoint of its architecture, converted to safe weights before the deployment starts
when safe weights are on and downloaded as a pickled `.pth` when they are off. A deployment
that is starting again instead loads the version it registered last, and its iteration count
carries on from that checkpoint.

Starts an endless fine-tune on a background thread. It waits there until `initial_samples`
labeled images have arrived.

Takes labeled images on `POST /samples`. Each one is downloaded, the annotation named with it
(or else its newest one) is read, and its boxes join the training set. A class nobody had drawn yet is appended to the vocabulary.

Answers `POST /predict` with the weights as they stand, pausing training for the length of one
forward pass so a prediction never sees a half-applied update.

Registers the weights as a version of the Model every `publish_every_minutes` and on
`POST /checkpoint`, advancing one version rather than adding one per publish.

## FAQ

#### Can a flow start the session by itself?

Yes. Draw an edge into this node from the step that produces each batch: the first time the
flow reaches it, the session starts, and the nodes after it run once it answers requests. When
the flow reaches it again while the session is up, the session keeps running untouched and the
nodes after it run straight away. A stopped session is started again. Pressing **Run** on the
node while its session is up still asks you to stop it first.

#### Which labelers can use the session?

Without **Labeling dataset**, every labeling step in the workspace lists the session in the
labeling tool, so two flows running sessions at once see each other's. Pick the flow's
labeling pool there and only labeling steps drawing from it list the session, and only they
can send it images or ask it for predictions. The Deploy dialog on the Deployments page offers
the same field.

#### How do I pre-label only once the session is good enough?

A fresh session's boxes can cost a labeler more time to fix than to draw. Before training on
each submitted image, the session guesses its boxes and scores the guess against what the
labeler drew, and the node's **Prelabel quality** output shows the assistance score over the
latest 10 scored images, the same score Prelabeling efficiency reports. It reads 0% until 10 have been scored. Put two
[Condition](/node-library/nodes/flow-control-condition) nodes on it in front of
[Prelabel with live training](/node-library/nodes/models-general-prelabel-with-live-training):
at or above your bar, for example 60, the batch is pre-labeled; below it, the batch goes to
labeling without boxes and nothing is predicted.

#### 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, the number of images
submitted, the iteration and loss, and the vocabulary the session is training in.

#### What happens when the model has learned all it can from the current images?

Training pauses. The `plateau_*` keys watch the loss over two moving windows, and once it stops
falling the session stops burning GPU on data it has exhausted. The next submitted image
resumes it. Set `plateau_window: 0` to train without ever pausing.

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

Only if `classes` in Config lists the class names up front. Grounding DINO is prompted with
class names, so a session seeded that way pre-labels from the very first image using the public
weights. Left empty, the vocabulary is learned from submissions and `POST /predict` answers 400
until the first labeled image arrives.

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

Its boxes are replaced by the newer ones. That is what makes correcting an image worth doing:
the session trains on the corrected version, not on both.

#### Are the predictions shown in the labeling tool kept?

Yes. Each prediction a labeler gets in the labeling tool is saved on the image, so
[Prelabeling efficiency](/node-library/nodes/evaluate-evaluate-live-training-prelabeling) can
compare the labeler's submission with it. Saving runs in the background and does not slow the
tool down.

#### Where do the trained weights go?

Into the Model input's own family in the Model Registry, as one version that is advanced on
every publish rather than a new version each time. It is ready from the first publish, so a
predict or train node downstream can pick up the session's weights while it is still running.

#### Does stopping the deployment lose the training?

Only what was trained since the last publish that finished. A stopping container is given 90
seconds, and the session spends up to 75 of them registering its weights, which is usually
enough. A machine that is lost without warning gives it no time at all, so
`publish_every_minutes` is what actually bounds the loss. When the last publish fails or does
not finish in time, the stopped deployment carries a warning saying its shutdown did not
finish. Call `POST /checkpoint` before stopping a session you care about.

#### What happens when the deployment restarts or moves to another machine?

It picks up where it left off: started again, or moved because the cloud reclaimed its spot
machine, the session loads the version of the Model it registered last, keeps advancing that
same version and continues counting iterations from it. The images it trained on are not kept
with the weights, so `GET /status` reports no samples until they are submitted again. Until it
holds as many images as the version was trained on, submissions do not count towards
**Prelabel quality**: the weights have already learned them. A deployment that never
registered a version starts from the Model input as before.

#### What does this node not support?

One GPU and one session per deployment. It trains bounding boxes only, so a polygon or mask
label is learned as the box around it. It holds no validation split and reports no metrics
beyond the training loss, because nothing is held out. The submitted images live in the
container, so a restarted deployment resumes from its last registered version with an empty
training set.

## Inputs

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

Model the session starts from, and the model each checkpoint is registered as a new version of. Copy a Grounding DINO entry from the zoo into this workspace to get one. A version with no weights of its own starts from the public checkpoint its catalog entry names, a pickled `.pth`. With safe weights on, the first deployment that uses it waits while the version is converted to safe weights, and the session loads its `model.safetensors`. With safe weights off, the session downloads the `.pth` and loads it as it is. Key: `MODEL`.

---

**`Labeling dataset`** `dataset`

The dataset a labeling step takes its images from - this flow's labeling pool. 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 the background fine-tune and for prediction. The vocabulary comes from the ontology of the dataset the samples are submitted from, so the session can pre-label every class from the first image without anyone listing them. classes adds names that ontology does not carry, and every class drawn on a submitted image is appended too. The plateau\_\* keys pause training once the loss stops falling, until a new sample arrives. publish_every_minutes is how often the running weights are registered as a version. Key: `CONFIG`.

---

## Outputs

**`Report`** `report`

Live report for the session: what it has trained on, how close its prelabels are getting to what the labeler submits, loss curves and its predictions on images not labeled yet. It keeps updating for as long as the session is up. Shown as an artifact. Key: `REPORT_ID`.

---

**`Model`** `model`

The weights the session has trained so far, as `&lt;model id&gt;@&lt;version id&gt;`. Wire it into the Model input of a predict or evaluate node to label the rest of the dataset once the session is good enough. It appears after the first checkpoint and keeps pointing at the latest weights, so a run started later uses what the session knows by then. Shown as an artifact. Key: `MODEL`.

---

**`Prelabel quality`** `string`

The assistance score of the session's guesses over its latest 10 scored images, computed as Prelabeling efficiency does - for example 62% assistance over the latest 10 images. Each submitted image is scored before the session trains on it, so this is measured even while nothing is pre-labeled. It reads 0% until 10 images have been scored. Compare it in a Condition to decide whether a batch is worth pre-labeling before it reaches Prelabel with live training. Key: `PRELABEL_QUALITY`.

---

**`Deployment`** `deployment`

The running session. Wire it into a node that takes a deployment to send it samples or prediction requests while it is up. Key: `DEPLOYMENT`.

---

## Models and configuration

The Model input is resolved to one version before the container starts. A version with its own
checkpoint is loaded from that file. A version copied from the zoo with no weights of its own
starts from the public MM Grounding DINO checkpoint for its architecture, one of Swin-T, Swin-B or
Swin-L, which its catalog entry names as a pickled `.pth`. With safe weights on, OvalBee converts
that version to safe weights before the first deployment that uses it, which waits and then starts
by itself, and the session loads the converted `model.safetensors`. With safe weights off, the
session downloads the `.pth` when it starts and loads it as it is.

Config carries the whole fine-tune. `initial_samples` is how many labeled images must arrive before
training starts. `batch_size`, `lr`, `weight_decay`, `grad_clip`, `warmup_iters` and `amp` set the
optimizer, and `imgsz`, `random_flip`, `freeze_backbone` and `freeze_text_encoder` mirror the Train
Grounding DINO node. `imgsz` applies to both training and prediction, so the boxes the annotator
reviews come from the model at the resolution it was trained at. `conf_threshold` is the lowest
score a prediction keeps, and a `POST /predict` call may override that one key for itself.

## Runtime

Runs as a Docker deployment on the live-training pack's image, built on the `grounding_dino` node image,
which carries MMDetection 3.3 and the MM Grounding DINO configs, on the machine class picked for it. The fine-tune runs on a thread inside the same
process that answers requests, so the dataset it trains on is held in memory and the container
never reads it back from disk between iterations.

## JSON config

Machine-readable node interface for automation and advanced usage.

#### Show JSON

```json
{
  "name": "Serve live training with Grounding DINO",
  "description": "Keeps a Grounding DINO fine-tune running for as long as the deployment is up, learning from labeled images as they are submitted and answering prediction requests from the model being trained. Holds its machine for its whole lifetime. A machine without a GPU is only usable for a smoke test - one training iteration takes minutes there.",
  "category": "Models",
  "namespace": "ovalbee",
  "templateKey": "models/grounding_dino/serve_live_training_with_grounding_dino",
  "version": "v1",
  "inputs": [
    {
      "key": "MODEL",
      "label": "Model",
      "type": "model",
      "description": "Model the session starts from, and the model each checkpoint is registered as a new version of. Copy a Grounding DINO entry from the zoo into this workspace to get one. A version with no weights of its own starts from the public checkpoint its catalog entry names, a pickled `.pth`. With safe weights on, the first deployment that uses it waits while the version is converted to safe weights, and the session loads its `model.safetensors`. With safe weights off, the session downloads the `.pth` and loads it as it is.\n",
      "required": true,
      "default": null,
      "visibleWhen": null,
      "options": {
        "scope": "my",
        "framework": "grounding_dino",
        "task_type": "object_detection"
      }
    },
    {
      "key": "LABELING_DATASET",
      "label": "Labeling dataset",
      "type": "dataset",
      "description": "The dataset a labeling step takes its images from - this flow's labeling pool. 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 the background fine-tune and for prediction. The vocabulary comes from the ontology of the dataset the samples are submitted from, so the session can pre-label every class from the first image without anyone listing them. classes adds names that ontology does not carry, and every class drawn on a submitted image is appended too. The plateau_* keys pause training once the loss stops falling, until a new sample arrives. publish_every_minutes is how often the running weights are registered as a version.\n",
      "required": true,
      "default": "# --- Vocabulary ---\nclasses: []         # extra classes to prompt with; the dataset's ontology is used automatically\n# --- Schedule ---\ninitial_samples: 2  # submitted images required before training starts\nwarmup_iters: 100\nbatch_size: 2\nlr: 5.0e-5\nweight_decay: 0.0001\ngrad_clip: 0.1      # gradient clip max norm (0 to disable)\namp: false          # fp16 mixed precision: less VRAM, faster on tensor-core GPUs\n# --- Pause when the loss stalls ---\nplateau_window: 150       # iterations per moving-average window (0 to never pause)\nplateau_threshold: 0.002  # smallest mean-loss drop between windows that still counts as progress\nplateau_patience: 3       # consecutive stalled checks before pausing\n# --- Input ---\nimgsz: 800          # input resolution (short-edge reference, long edge ~imgsz*1.667)\nrandom_flip: 0.5    # horizontal flip probability (0.0 to disable)\n# --- Model ---\nfreeze_backbone: false      # freeze the image backbone (faster, less VRAM)\nfreeze_text_encoder: false  # freeze BERT. Keep false so class names with shared tokens separate\n# --- Prediction ---\nconf_threshold: 0.3\n# --- Checkpoints ---\npublish_every_minutes: 10   # 0 to publish only when the deployment stops\n",
      "visibleWhen": null
    }
  ],
  "outputs": [
    {
      "key": "REPORT_ID",
      "label": "Report",
      "type": "report",
      "description": "Live report for the session: what it has trained on, how close its prelabels are getting to what the labeler submits, loss curves and its predictions on images not labeled yet. It keeps updating for as long as the session is up.\n",
      "artifact": true,
      "badge": false,
      "badgeOpens": null,
      "hidden": false
    },
    {
      "key": "MODEL",
      "label": "Model",
      "type": "model",
      "description": "The weights the session has trained so far, as `<model id>@<version id>`. Wire it into the Model input of a predict or evaluate node to label the rest of the dataset once the session is good enough. It appears after the first checkpoint and keeps pointing at the latest weights, so a run started later uses what the session knows by then.\n",
      "artifact": true,
      "badge": false,
      "badgeOpens": null,
      "hidden": false
    },
    {
      "key": "PRELABEL_QUALITY",
      "label": "Prelabel quality",
      "type": "string",
      "description": "The assistance score of the session's guesses over its latest 10 scored images, computed as Prelabeling efficiency does - for example 62% assistance over the latest 10 images. Each submitted image is scored before the session trains on it, so this is measured even while nothing is pre-labeled. It reads 0% until 10 images have been scored. Compare it in a Condition to decide whether a batch is worth pre-labeling before it reaches Prelabel with live training.\n",
      "artifact": false,
      "badge": false,
      "badgeOpens": null,
      "hidden": false
    },
    {
      "key": "DEPLOYMENT",
      "label": "Deployment",
      "type": "deployment",
      "description": "The running session. Wire it into a node that takes a deployment to send it samples or prediction requests while it is up.\n",
      "artifact": false,
      "badge": false,
      "badgeOpens": null,
      "hidden": false
    }
  ],
  "runtime": {
    "type": "docker",
    "devices": [
      "gpu",
      "cpu"
    ],
    "dockerImage": null
  },
  "widgets": {
    "widget": {
      "id": "report-preview",
      "settings": {
        "reportAsset": {
          "type": "variable",
          "value": "self.outputs.REPORT_ID"
        }
      }
    }
  }
}
```

## References

#### Sources and related pages

* [Train Grounding DINO](/node-library/nodes/models-grounding-dino-train-grounding-dino) — the offline fine-tune the hyperparameters here mirror.
* [Predict Grounding DINO](/node-library/nodes/models-grounding-dino-predict-grounding-dino) — batch prediction with a registered version.
* [MM Grounding DINO](https://github.com/open-mmlab/mmdetection/tree/v3.3.0/configs/mm_grounding_dino) — upstream configs and pretrained checkpoints, MMDetection 3.3.0.
* [MMDetection](https://github.com/open-mmlab/mmdetection/tree/v3.3.0) — Apache-2.0.