Export YOLO

GPU Dockerfile
First run can take longer while the worker pulls the configured Docker image.

Overview

Converts a YOLO detection checkpoint to PyTorch, ONNX, or TensorRT, whichever formats you tick, and attaches each result to the model version the weights came from.

The model then carries its weights and every format it has been exported to, and the model page lists them for download. A format already exported from the same checkpoint is reused instead of converted again.

Use it after Train YOLO when a checkpoint needs a deployment format.

Train YOLO Export YOLO Exported model files

Prerequisites

RequirementWhat you need
YOLO modelA YOLO detection model version with its own .pt or .pth checkpoint, e.g. one trained by Train YOLO. A model copied from the catalog has no file to convert, because Ultralytics downloads its weights by name.
NVIDIA GPUA GPU worker with a working NVIDIA runtime. The node requests one for every run, and TensorRT has no CPU fallback.

How it works

1

Checks each ticked format against the exports already on the model version and skips the ones built from the same checkpoint before.

2

Downloads the version’s checkpoint once, for however many formats are left to build.

3

Hands it to Ultralytics per format. The PyTorch target stages the checkpoint itself, and a format that comes back as a folder is zipped first.

4

Attaches every produced file to the source model version and returns the same model reference it was given.

FAQ

When the model version already carries an export of that format built from the same checkpoint. Every ticked format is checked separately, so a run can build one format and reuse another. Rerunning with the same settings therefore builds nothing new.

No. An export is another file on the version it came from, and the Model output is the same reference as the input, so downstream nodes keep running the original weights.

One run downloads the checkpoint once and attaches every format to the same version. A TensorRT engine is built from an intermediate ONNX graph, so ticking ONNX as well costs one trace rather than two.

The checkpoint the picked version points at, which for a training run is its best checkpoint. The file must end in .pt or .pth, otherwise the run stops.

TensorRT builds its engine on a CUDA GPU and has no CPU fallback. The node checks for a GPU before it downloads or converts anything, so a run without one stops before any format is built. When a GPU is visible, every format in the run, ONNX included, is exported on it.

Instance segmentation models aren’t offered in the Model picker. Every export is full precision (FP32), and the remaining Ultralytics export settings stay at their defaults. At least one format must be ticked, or the run stops.

The version may have no weights of its own, as with a model copied from the catalog, or its model files may hold no .pt or .pth checkpoint. Train from the catalog model first, then export the version that run produced.

Inputs

Model
modelRequired

Detection model whose checkpoint is exported, e.g. a version trained in this workspace. A model copied from the catalog hosts no weights of its own and has nothing to export, so train from it first. Key: MODEL.

Export to PyTorch
booleanDefaults to falseRequired

Attach the checkpoint itself as a PyTorch export. Key: EXPORT_PYTORCH.

Export to ONNX
booleanDefaults to falseRequired

Trace the checkpoint to an ONNX graph. Key: EXPORT_ONNX.

Export to TensorRT
booleanDefaults to falseRequired

Build a TensorRT engine. It is cut from an intermediate ONNX graph, so ticking ONNX as well costs one trace rather than two. Key: EXPORT_TENSORRT.

Outputs

Exported formats
string

Format keys this run produced, comma separated. Read by the download widget. Hidden from the flow editor. Key: EXPORT_FORMATS.

Model
model

The model that was exported, as <model id>@<version id> - the same reference this node was given. An export is another file on that version, not a version of its own, so this output wires on to anything the input accepts. Shown as an artifact. Key: MODEL.

Widgets

The model download widget downloads what this run produced: a single file when the run produced exactly one, and a zip of every ticked format, class lists included, when it produced more. The model version page lists the same files one by one.

Runtime

The export runs in a Docker image based on Ultralytics 8.4.33 on a GPU worker, with TensorRT 10 and the GPU build of ONNX Runtime installed. TensorRT requires a CUDA GPU visible inside the container.

JSON config

Machine-readable node interface for automation and advanced usage.

{
"name": "Export YOLO",
"description": "Convert a YOLO checkpoint to PyTorch, ONNX and TensorRT and attach every format to the model it came from.",
"category": "Models",
"namespace": "ovalbee",
"templateKey": "models/yolo/export_yolo",
"version": "v1",
"inputs": [
{
"key": "MODEL",
"label": "Model",
"type": "model",
"description": "Detection model whose checkpoint is exported, e.g. a version trained in this workspace. A model copied from the catalog hosts no weights of its own and has nothing to export, so train from it first.\n",
"required": true,
"default": null,
"visibleWhen": null,
"options": {
"framework": "yolo",
"task_type": "object_detection"
}
},
{
"key": "EXPORT_PYTORCH",
"label": "Export to PyTorch",
"type": "boolean",
"description": "Attach the checkpoint itself as a PyTorch export.",
"required": true,
"default": false,
"visibleWhen": null
},
{
"key": "EXPORT_ONNX",
"label": "Export to ONNX",
"type": "boolean",
"description": "Trace the checkpoint to an ONNX graph.",
"required": true,
"default": false,
"visibleWhen": null
},
{
"key": "EXPORT_TENSORRT",
"label": "Export to TensorRT",
"type": "boolean",
"description": "Build a TensorRT engine. It is cut from an intermediate ONNX graph, so ticking ONNX as well costs one trace rather than two.",
"required": true,
"default": false,
"visibleWhen": null
}
],
"outputs": [
{
"key": "EXPORT_FORMATS",
"label": "Exported formats",
"type": "string",
"description": "Format keys this run produced, comma separated. Read by the download widget.",
"artifact": false,
"badge": false,
"badgeOpens": null,
"hidden": true
},
{
"key": "MODEL",
"label": "Model",
"type": "model",
"description": "The model that was exported, as `<model id>@<version id>` - the same reference this node was given. An export is another file on that version, not a version of its own, so this output wires on to anything the input accepts.\n",
"artifact": true,
"badge": false,
"badgeOpens": null,
"hidden": false
}
],
"runtime": {
"type": "docker",
"requiresGpu": true,
"dockerImage": "cr.internal.supervisely.com/ovalbee-internal/nodes/yolo-export:0.0.11"
},
"widgets": {
"widget": {
"id": "model-download",
"settings": {
"assetId": {
"type": "variable",
"value": "self.outputs.MODEL"
},
"format": {
"type": "variable",
"value": "self.outputs.EXPORT_FORMATS"
}
}
}
}
}

References