Model conversion

Model conversion1. Raspberry Pi 5 YOLO11 (benchmark)2. Model conversion2.1, CLI: pt → onnx, pt → ncnn2.2、Python:pt → onnx → ncnn4. Model predictionCLI usageReferences

1. Raspberry Pi 5 YOLO11 (benchmark)

YOLO11 benchmark data comes from the Ultralytics team, which tests models in multiple different formats (data is for reference only)

Officially, only YOLO11n and YOLO11s models were benchmarked, because other models are too large to run on Raspberry Pis and cannot provide good performance.

image-20241231113339184

2. Model conversion

According to the test parameters of different formats provided by the Ultralytics team, we can find that the inference performance is best when using TensorRT!

2.1, CLI: pt → onnx, pt → ncnn

Convert PyTorch format models to onnx and ncnn

image-20250317183755402

image-20241231122558848

2.2、Python:pt → onnx → ncnn

Convert the PyTorch model to TensorRT: The conversion process will automatically generate an ONNX model

Note: The converted model file is located in the converted model file location

image-20241231130524974

4. Model prediction

CLI usage

CLI currently only supports calling USB cameras. CSI camera users can directly modify the previous python code to call onnx and ncnn models!

image-20241231141309294

image-20241231141137709

 

References

https://docs.ultralytics.com/guides/raspberry-pi/

https://docs.ultralytics.com/integrations/tensorrt/