Welcome to RDK S600 Developer Kit repository
08.Model conversion
Model Conversion
Model Conversion1、YOLO26 (Benchmark)Comparison Chart2、Model Conversion2.1、CLI: pt → onnx, pt → ncnn2.2、Python: pt → onnx → ncnn4、Model PredictionCLI UsageReferences
1、YOLO26 (Benchmark)
Ultralytics team benchmarked YOLO26 on ten different model formats, measuring speed and accuracy, including: PyTorch, TorchScript, ONNX, OpenVINO, TF SavedModel, TF GraphDef, TF Lite, MNN, NCNN, and ExecuTorch. The benchmark tests were run on Raspberry Pi 5 at FP32 precision with a default input image size of 640.
Comparison Chart

2、Model Conversion
The first time you use the export mode of YOLO26, some dependencies will be automatically installed. Please wait for it to complete automatically!
2.1、CLI: pt → onnx, pt → ncnn
Convert PyTorch format models to onnx and ncnn
xxxxxxxxxxcd /home/sunrise/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: The conversion process will automatically generate the ONNX model
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 the model to ONNX formatmodel.export(format="onnx") # This will create 'yolo11n.onnx' in the same directory
# Export the model to NCNN formatmodel.export(format="ncnn") # creates 'yolo11n_ncnn_model'
Note: The converted model files are located at the converted model file location

4、Model Prediction
CLI Usage
CLI currently only supports USB camera. CSI camera users can directly modify the previous Python code to call 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
