Train RF-DETR
Overview
Fine-tunes an RF-DETR object detector from your workspace registry on OvalBee datasets, and registers the result as a new version of that model.
The node exports the train and validation datasets to COCO format inside its own working directory, trains on them, and uploads the checkpoints to the new version, so no conversion or upload node sits in between. The run publishes a live report that updates throughout training, and the Best Loss badge shows the lowest training loss reached.
This node runs RF-DETR Nano, Small, Medium and Large, the four detection sizes under Apache-2.0, with the authors’ own rfdetr training code (the Lightning stack, their EMA and best-checkpoint rules), unchanged. Starting from a COCO catalog model fine-tunes the Objects365 and COCO pretrained weights; starting from one of your earlier runs starts from its trained weights.
Pretrained Models
- RF-DETR Large
- RF-DETR Medium
- RF-DETR Nano
- RF-DETR Small
Prerequisites
What the node builds
Both directories are ephemeral: they live only for the duration of the task, and the checkpoints are uploaded to the model version before it ends. A rerun exports its datasets again.
How it works
Exports the train and validation datasets to COCO format in one pass, so both splits share the same class index space.
Fetches the starting weights through the safe-weights check: the picked version’s own weights, or for a catalog model the authors’ COCO weights its catalog entry names.
FAQ
How does it estimate data usefulness?
The node saves a checkpoint every tenth of the epoch budget (it sets checkpoint_freq for this), and after training it runs inference over the training split with a few of them — near 10%, 25% and 50% of the run — 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.5, 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 node in front of this one?
No. The node exports its datasets to COCO itself. Connect the datasets directly. RF-DETR trains on bounding boxes, so polygon and mask annotations are used through their bounding boxes.
What happens when I rerun the node?
Every run adds a new version to the model, or to Destination model when one is set, unless it continues a version that is not fully trained (below). Earlier versions stay in the registry and the source datasets aren’t changed. When Model names the model itself rather than a pinned version, it follows the newest version that is ready or not fully trained, so a rerun that trains into the same model starts from the previous run’s result, or continues that run when it did not finish.
Where do the trained files end up?
On the new model version: the best weights as model.safetensors, with the config.json that describes them (architecture, input size, classes in output order), the training log, and your hyperparameters. The periodic snapshots the usefulness estimate scores stay in the task. The version also records the class list, both datasets, the version training started from, the training report, and the metrics of the epoch whose weights it carries: mAP50, mAP50-95, and training loss.
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, the EMA weights and their update count, the mixed-precision scaler, the training loop’s counters and callback state (early stopping’s patience among them), the batch size and the best mAP so far, with the best weights and the training log as of that epoch. A checkpoint is about four times the size of the weights (the network, its EMA copy and the optimizer’s two running averages): with Nano, 121 MB of network and 362 MB of training state, about 0.5 GB uploaded at every checkpoint while the next epoch trains; the version keeps only the latest one, and none once the run has finished. 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 picks up the learning-rate schedule, the EMA and the batch size where the checkpoint left them (batch_size: auto is not measured again), but not the first epochs’ random draws: a run with a seed is seeded anew from it and the epoch it continues at, so its remaining epochs see the images in new orders and with new augmentations. If the continued epochs never beat the best mAP the run had reached, the version keeps the best weights it had. The epoch that ends the run, its last one or an early stop, 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 RF-DETR version differ. To train longer or with other settings, start from a fully trained version, such as the one the run started from, or save the unfinished one as a new version and train from that.
What if I leave the validation dataset empty?
The export points validation at the training images, so the mAP the run reports is measured on data the model trained on and reads higher than it will score on new images.
Which classes does the model learn?
When the train dataset is pinned to an ontology, the model learns that ontology’s object classes in its order, and labels of any other class are skipped. Otherwise the classes come from the annotations in the datasets. The class list is also stored in the model’s config.json, so prediction names classes the same way.
Which architecture should I start with?
Nano or Small when you need speed or an edge deployment, Large when accuracy matters more than latency. Roboflow’s published COCO AP50:95 is 48.4 for Nano, 53.0 for Small, 54.7 for Medium and 56.5 for Large, each at its own native input size.
Why does the run stop with an out-of-memory error?
The architecture, batch_size and resolution together decide GPU memory. Lower batch_size first and raise grad_accum_steps to keep the effective batch (the default is 4 x 4 = 16), then resolution, before moving to a smaller model.
Why did the run fail right at the start?
Usually the datasets, the model, or the config. The datasets have to carry annotation classes, the picked version has to name one of the RF-DETR architectures listed above, and Hyperparameters has to be YAML whose keys RF-DETR’s TrainConfig accepts. Every plain scalar field of that config - a number, a switch or one name out of a fixed set, sync_bn and pack_targets among them - may be set. A key the node sets itself (the dataset, output directory, weights, class list, resume, logger switches) is refused by name, and resolution has to be a multiple of 32. multi_scale and compute_val_loss are each a switch or one of their named values, which is all they take: multi_scale: 1 is neither.
Inputs
Dataset the model learns from. Its annotations define the classes the trained model will detect. Key: TRAIN_DATASET.
Dataset held back to measure accuracy after each epoch. Leave it empty and accuracy is measured on the training assets instead, which makes the reported mAP look better than it is. Key: VAL_DATASET.
After training, score every training image with checkpoints saved across the run to estimate how much of the data was actually needed, and publish the subset worth keeping. Sets checkpoint_freq to a tenth of the epoch budget so those checkpoints exist, and adds a few inference passes over the training split after the run. Key: ESTIMATE_DATA_USEFULNESS.
Model to fine-tune. A version copied from the zoo starts from the authors’ COCO weights of that architecture, one from an earlier run from its trained weights. 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.
Model the new trained version is added to, when it should not go to the model you are training. Leave empty to add it to the Model above. Key: DESTINATION_MODEL.
Training hyperparameters in YAML. Keys are RF-DETR’s own TrainConfig fields (epochs, batch_size, grad_accum_steps, lr, lr_encoder, weight_decay, warmup_epochs, ema_decay, use_ema, num_workers, eval_interval, early_stopping, seed, optimizer and lr_scheduler presets, …) plus resolution (a multiple of 32), max_dets, the detections per image validation counts (300 unless set), and checkpoint_freq. Your datasets, classes, output paths and starting weights are filled in for you, so keys such as pretrain_weights, resume or output_dir are refused, and so is any key the node does not list, or a value of the wrong type, at the start of the run. Key: CONFIG.
Outputs
ID of the asset containing the live RF-DETR 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, evaluate or export node and pins it to exactly these weights. Empty when the run could not be registered. Shown as an artifact. Key: MODEL.
Lowest total training loss achieved (shown as a badge). Shown on the node as a badge. Key: BEST_LOSS.
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 RF-DETR 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. A version copied from the catalog starts from the authors’ COCO weights its catalog entry names; one produced by an earlier run starts from its trained weights. Either way the new version records the picked version as its starting point.
Set Destination model to file the result elsewhere. The trained version is created there instead, and Model is then only the starting weights. Both pickers list only RF-DETR detection models of this workspace, with their ready versions and their incomplete ones, marked as not fully trained.
Hyperparameters is YAML in the key names of RF-DETR’s own TrainConfig, plus resolution and max_dets. The dataset paths, the output directory and the class list are filled in by the node, so leave those out and set what you want to change: epochs for run length, batch_size and grad_accum_steps for memory and the effective batch, resolution for input size (a multiple of 32, default 640), lr, lr_encoder and weight_decay. max_dets is the number of detections per image that validation counts (300 unless set); it is applied to the validation metric the best checkpoint is chosen by. A key the node does not list, or a value of the wrong type, fails the run at its start; so do keys that would name a file or code, such as pretrain_weights, resume, or an optimizer or lr_scheduler import path.
The defaults are the authors’ recipe at an effective batch of 16 on a 16 GB card: 100 epochs, learning rate 1e-4 (1.5e-4 for the encoder), EMA, multi-scale training and the step learning-rate drop. Removing a key restores RF-DETR’s own default rather than disabling the feature. The best weights are the EMA weights with the highest validation mAP50-95 (the live weights when use_ema is off).
Report
The report appears near the start of the run and updates as training produces results. It opens from 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 won’t fit is the first thing to check when a run dies early.
The first run takes longer while the worker pulls the image, and a catalog model downloads its pretrained weights on every run that starts from it. Every run exports its datasets before training starts, so a large dataset adds a download phase ahead of the first epoch.
JSON config
Machine-readable node interface for automation and advanced usage.