How to Use Export YOLO ONNX model to use the ZED Custom Object Detection
Introduction
This page will show you how to export a YOLO model into an ONNX file to use with the ZED YOLO TensorRT inference example, or the CUSTOM_YOLOLIKE_BOX_OBJECTS mode in the native ZED SDK Object Detection module.
This allows you to train your custom model using Ultralytics YOLO (v5, v8, v10, v11, v12), YOLOv6, or YOLOv7.
It can also be used with the default model trained on the COCO dataset (80 classes) provided by the framework maintainers. A custom detector can be trained using the same architecture. These tutorials walk you through the workflow of training a custom detector:
- YOLOv6: https://github.com/meituan/YOLOv6/blob/main/docs/Train_custom_data.md
- YOLOv5: https://github.com/ultralytics/yolov5/wiki/Train-Custom-Data
- YOLO12 https://blog.roboflow.com/train-yolov12-model/
It enables the use of ZED 3D cameras with YOLO object detection, adding 3D localization and tracking to the most recent YOLO models using your own classes.
YOLO Comparison in terms of latency-accuracy (left) and FLOPs-accuracy (right) trade-offs (from YOLOv12)
Workflow
The process is as follows:
- Train your model or use an existing state-of-the-art (SOTA) model.
- Export it into an ONNX file.
- Load the ONNX file into the SDK or sample to generate an optimized model. This process uses the TensorRT framework to run inference and requires an initial step of inference engine generation.
ZED SDK samples are available on GitHub:
Ultralytics YOLO (v5, v8, v10, v11, v12)
Installing ultralytics
ultralytics can be installed directly from pip using the following command:
ONNX file export
In this documentation, we’ll use the CLI for export https://docs.ultralytics.com/modes/export/
YOLOv12
YOLOv11
YOLOv10
YOLOv8
YOLOv5
Variants
For each model the variant (n, s, m, l, x) can be selected, like:
Dynamic size
The model can also used dynamic dimensions:
Custom model
For a custom model model the weight file can be changed:
Please refer to the corresponding documentation for more details https://github.com/ultralytics/ultralytics
YOLOv6
The sample was mainly tested with YOLOv6 v3.0 but should work with other version with minor to no modifications.
Installing yolov6
YOLOv6 can be installed directly from pip using the following command:
ONNX file export
For a custom model model the weight file can be changed:
Please refer to the corresponding documentation for more details https://github.com/meituan/YOLOv6/tree/main/deploy/ONNX
YOLOv7
Installing yolov7
YOLOv7 can be installed directly from pip using the following command:
ONNX file export
In this documentation, we’ll use the export script export.py
The --end2end option must NOT be used to run the inference with the ZED SDK for compatibility reasons.
For a custom model model the weight file can be changed:
Please refer to the corresponding documentation for more details https://github.com/WongKinYiu/yolov7/tree/main?tab=readme-ov-file#export
YOLOv5
Installing yolov5
YOLOv5 can be installed directly from pip using the following command:
ONNX file export
For a custom model model the weight file can be changed:
Please refer to the corresponding documentation for more details https://docs.ultralytics.com/yolov5/tutorials/model_export/

