Welcome to RDK X5 Board repository
08.Model conversion
Model Conversion
Model Conversion1. Raspberry Pi 5 YOLO26 (Benchmark Testing)Comparison Chart2. Model Conversion2.1. CLI: pt → onnx, pt → ncnn2.2. Python: pt → onnx → ncnn4. Model PredictionCLI UsageReferences
1. Raspberry Pi 5 YOLO26 (Benchmark Testing)
The Ultralytics team conducted benchmark testing on YOLO26 across ten different model formats, measuring speed and accuracy. These formats include: PyTorch, TorchScript, ONNX, OpenVINO, TF SavedModel, TF GraphDef, TF Lite, MNN, NCNN, ExecuTorch. The benchmark testing was run on Raspberry Pi 5 with FP32 precision, with a default input image size of 640.
Comparison Chart

2. Model Conversion
The first time using YOLO26's export mode will automatically install some dependencies, just wait for automatic completion!
2.1. CLI: pt → onnx, pt → ncnn
Convert PyTorch format models to onnx and ncnn
xxxxxxxxxxcd /home/pi/ultralytics26
xyolo export model=yolo26n.pt format=onnx# yolo export model=yolo26n-seg.pt format=onnx# yolo export model=yolo26n-pose.pt format=onnx# yolo export model=yolo26n-cls.pt format=onnx# yolo export model=yolo26n-obb.pt format=onnxyolo export model=yolo26n.pt format=ncnn# yolo export model=yolo26n-seg.pt format=ncnn# yolo export model=yolo26n-pose.pt format=ncnn# yolo export model=yolo26n-cls.pt format=ncnn# yolo export model=yolo26n-obb.pt format=ncnn


2.2. Python: pt → onnx → ncnn
Convert PyTorch format models to TensorRT: conversion process will automatically generate ONNX models
xxxxxxxxxxcd /home/sunrise/ultralytics26/yahboom_demo
xxxxxxxxxxpython3 model_pt_onnx_ncnn.py
xxxxxxxxxxfrom ultralytics import YOLO# Load a YOLO PyTorch modelmodel = YOLO("/home/sunrise/ultralytics26/yolo26n.pt")# model = YOLO("/home/sunrise/ultralytics26/yolo26n-seg.pt")# model = YOLO("/home/sunrise/ultralytics26/yolo26n-pose.pt")# model = YOLO("/home/sunrise/ultralytics26/yolo26n-cls.pt")# model = YOLO("/home/sunrise/ultralytics26/yolo26n-obb.pt")# Export model to ONNX formatmodel.export(format="onnx") # This will create 'yolo11n.onnx' in the same directory# Export model to NCNN formatmodel.export(format="ncnn") # creates 'yolo11n_ncnn_model'Note: The converted model files are located in the converted model file location

4. Model Prediction
CLI Usage
CLI currently only supports calling USB cameras. CSI camera users can directly modify the previous Python code for calling onnx and ncnn models!
xxxxxxxxxxcd /home/sunrise/ultralytics26
xxxxxxxxxxyolo predict model=yolo26n.onnx source=0 save=False show

xxxxxxxxxxyolo predict model=yolo26n_ncnn_model source=0 save=False show
