Serve live training with Grounding DINO
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. 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.
Prerequisites
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.
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 nodes on it in front of 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 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 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.
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.
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
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.
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. Shown as an artifact. Key: MODEL.
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.
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.