Train Grounding DINO
Overview
Fine-tunes Grounding DINO on an OvalBee dataset. The node exports the datasets to COCO itself, so no conversion step runs in front of it.
Grounding DINO detects objects from text, which means the pretrained model already finds classes it was never trained on. Fine-tuning is what you do when that zero-shot behaviour is close but not accurate enough on your own data.
The badge shows the best mAP at IoU 0.5 reached on the validation split.
Pretrained Models
- Grounding DINO Swin-T (lighter, ~170M params)
- Grounding DINO Swin-B (~240M params)
- Grounding DINO Swin-L (best quality, ~340M params)
Prerequisites
What the node writes to disk
The node builds this tree in the task’s own scratch space at the start of every run, and data.yaml names the classes it trained on. Nothing here survives the run — the checkpoints leave through the model asset.
How it works
Fine-tunes Grounding DINO, writing metrics and TensorBoard events beside the dataset, the weights as config.json plus model.safetensors each time validation mAP improves, and, at the end of the first epoch and then at an epoch’s end at most every two minutes, a checkpoint a resumed run continues from.
FAQ
How does it estimate data usefulness?
The node saves the model’s weights near 10%, 25% and 50% of the epoch budget into a scratch directory that is never published, and after training it runs inference over the training split with those snapshots and with the final weights. For every labelled object it records the confidence of the best matching prediction of the right class, or zero when nothing matches, and scores each image by the average of one minus those confidences. An object counts as found once that confidence reaches 0.3, the default confidence threshold of the matching Predict node, and an image counts as learned once at least 80% of its objects are found.
Images learned in the first quarter of the run and never lost again are the ones the model needed least. Confident predictions that match no label are counted separately: they point at missing labels or genuine mistakes, and they do not decide whether an image was learned.
How is the Recommended keep set chosen?
Only images solved early and never forgotten can be dropped, easiest first, and every class keeps at least 80% of its instances. When nothing is safely droppable, the output stays empty rather than handing over a dataset the report advises against. To check the estimate, train again on the keep set from the same model this run started from and compare the two runs’ evaluation metrics.
Do I need a conversion step in front of this node?
No. Connect the datasets directly. The node exports them to COCO itself, in a single pass so the two splits agree on the class order.
Where do the trained files end up?
On the model asset, as config.json plus model.safetensors: a plain safetensors state_dict, text encoder included. The run writes everything else to scratch space that disappears with the container.
Is the model asset ready to use after training?
Yes. It carries the checkpoint, so predict and export nodes can take it as-is.
What happens if training fails partway through?
The version is created before training starts and receives the best weights so far about every two minutes. At the end of the first epoch, and then at an epoch’s end at most every two minutes, the node also saves a checkpoint into the version: the network, the optimizer, the position in the learning-rate schedule and its warmup, the mixed-precision scaler and the best mAP so far, with the best weights and logs as of that epoch. The optimizer’s state makes a checkpoint about three times the size of the weights: with Swin-T, 692 MB of weights and 1.4 GB of training state, about 2.1 GB uploaded at every checkpoint while the next epoch trains. Only the latest one is kept. Training never waits for that upload, and no new checkpoint starts while one uploads, so a run that is killed loses the training since its last checkpoint that finished uploading: about one epoch or two minutes, whichever is longer, plus the time a checkpoint takes to upload. A run that stops after its first checkpoint leaves the version Incomplete: the model pickers offer it with its best weights so far, marked as not fully trained, and running the node with that version in Model (Latest picks it while it is the newest) continues the run from its last checkpoint into the same version, with the settings it started with. The continued run does not repeat the first epochs’ random draws, and an epoch that does not beat the best mAP reached before the interruption leaves the version’s best weights alone. The run’s last epoch is not a checkpoint, so a run interrupted after it repeats that epoch. On Kubernetes, a run whose machine was taken away is retried and continues from its last checkpoint by itself. A run that stops before its first checkpoint marks its version failed, and it isn’t offered in the model pickers. If uploading fails five times in a row, the node stops training rather than carry on with no way to save the result.
Why does a continued run refuse to start?
A run that continues an unfinished version trains with the settings it started with, so the node first compares the run with the checkpoint and refuses, naming each difference, when the hyperparameters (epochs included), the classes, the datasets, the architecture or the mmdet version differ. To train longer or with other settings, start from a fully trained version, or save the unfinished one as a new version and train from that.
Which hyperparameters, and written how?
Only the keys the default lists: a key outside it is refused by name rather than ignored, so nothing in the YAML can name weights, a file, a URL or code for the run to load.
Each value may be written any way YAML produces the number or the switch it means. lr: 1e-4 and lr: 0.0001 are the same learning rate, epochs: 12, epochs: 12.0 and epochs: 1e1 the same length, and freeze_backbone: true and freeze_backbone: 1 the same switch. The three switches - amp, freeze_backbone, freeze_text_encoder - may be left empty, which is off, and so may the eight optional augmentation settings - scale_min, scale_max, brightness_delta, contrast_lower, contrast_upper, saturation_lower, saturation_upper, hue_delta - for their default, which is what commenting them out does. amp_dtype takes fp16 or float16, bf16 or bfloat16, and lr_schedule takes constant or cosine.
What is refused is a value the run would read as something else: amp: "no" is a non-empty word, which reads as on, a lr_schedule that is neither of the two schedules would silently train at a constant learning rate, and a whole number written as text that no double holds exactly (imgsz: 1e100) would arrive as a different number. seed takes a whole number from 0 to 2147483647, the range every generator in the run accepts.
Can I watch the run while it trains?
Yes. The report is published early and keeps updating, so charts and checkpoints appear as they are produced rather than only at the end.
Do I need to train at all?
Often not. The pretrained model detects classes from their names, so try Predict Grounding DINO on your data first and fine-tune only if the zero-shot result falls short.
Which backbone should I pick?
Swin-T for speed and the smallest memory footprint, Swin-L when accuracy matters most, Swin-B in between. Larger backbones need a smaller batch size to fit.
Why did the run fail right at the start?
Usually the data or the config. Both datasets need annotated objects — a validation split with no boxes is refused rather than trained blind — and Config has to be a valid YAML mapping whose keys the trainer accepts, each with a value of its type.
Inputs
Dataset the model is trained on. The node converts it to COCO itself. Key: TRAIN_DATASET.
Dataset held out for validation. Grounding DINO reports mAP on it, and cannot train without it. Key: VAL_DATASET.
After training, score every training image with weight snapshots saved near 10%, 25% and 50% of the run to estimate how much of the data was actually needed, and publish the subset worth keeping. The snapshots are weights only and are not published, scoring adds a few inference passes over the training split after the run. Key: ESTIMATE_DATA_USEFULNESS.
Model to fine-tune: its weights are where the run starts. A version copied from the zoo downloads the weights its catalog entry names, which are pickled .pth files that load only with safe weights off, one from an earlier run continues from its model.safetensors. The run is registered as a new version of this model unless Destination Model names another one. When the version picked is not fully trained (Latest picks one when it is the newest), the run continues that training with the settings it started with, not the ones set here. Key: MODEL.
Where the trained version is registered, when it should not go to the model being trained. Leave empty to add the version to the Model above. Key: DESTINATION_MODEL.
Training hyperparameters in YAML - how long the run trains, at what resolution, and how much the images are augmented. Comments in the default explain the less obvious ones, and a commented-out line stays off until you uncomment it. Key: CONFIG.
Outputs
ID of the asset containing the live Grounding DINO training report. Shown as an artifact. Key: REPORT_ID.
Reference to the registry version this run produced, as <model id>@<version id>. It wires into the Model input of a predict or evaluate node and pins it to exactly these weights. Empty when the run could not be registered. Shown as an artifact. Key: MODEL.
Best mAP50 achieved during training (shown as a badge). Shown on the node as a badge. Key: BEST_MAP50.
The training images this run’s usefulness estimate says are worth keeping. To check the estimate, wire it into the Train dataset of another Train Grounding DINO node that starts from the same model this run started from, and compare the two runs’ evaluation metrics. Short-lived, so copy it if you want to keep it. Empty when the estimate found nothing safe to drop. Shown as an artifact. Key: KEEP_DATASET.
Share of the training images the keep set retains. Shown on the node as a badge. Selecting the badge opens KEEP_DATASET. Key: KEEP_SHARE.
Models and configuration
Model is both what training starts from and where its result is filed: the run adds a version to that model. Its weights are downloaded and checked before anything loads them. A version copied from the zoo downloads the MM Grounding DINO checkpoint its catalog entry names from OpenMMLab: a pickled .pth, which loads only while the instance’s safe-weights setting is off. One produced by an earlier run continues from its model.safetensors, and the new version records it as its parent.
Set Destination Model to file the result elsewhere — the trained version is created there instead, and Model is then only the starting weights.
The Swin-T backbone is the fastest, Swin-L the most accurate, and Swin-B the middle ground.
Config holds the training settings as YAML. Dataset paths and the class count are injected by the node, and a key the node does not know, or a value of the wrong type (amp: "no", an lr_schedule other than constant or cosine), is refused: the config tunes the run, never names weights or files to load.
Set seed: 0 (or another integer from 0 to 2147483647) to choose the run’s seed. When omitted, a fresh run chooses one at random. The effective config and training checkpoint record the chosen seed, and a continued run keeps that original seed: the order the images are shown in each epoch and the seeds of the data-loading workers stay the ones the seed gives, as in a run never interrupted, while the training process’s own random draws start afresh from a seed derived from it at every continuation.
Report
The report appears near the start of the run and updates as training produces results. It opens in the preview widget on the node.
Report sections
Runtime
The node runs in its own GPU container. Memory use follows the architecture, the input size, and the batch size, so a model that will not fit is the first thing to check when a run dies early.
The first run takes longer while the worker pulls the image and downloads pretrained weights. Every run downloads its datasets again — the container keeps nothing between runs.
JSON config
Machine-readable node interface for automation and advanced usage.