Welcome to Jetson Orin NX Developer Kit repository
当製品の日本語版マニュアル資料は、こちらからご取得ください。
08.Model conversion
Model conversion
Model conversion1. jetson yolo26 (the benchmark test)2. Enable the best performance of the mainboard2.1. Enable the MAX power mode2.2. Enable the Jetson clocks3. Model conversion3.1. CLI: pt → onnx → engine 3.2. Python: pt → onnx → engine4. Model predictionThe CLI useReferences
1. jetson yolo26 (the benchmark test)
The yolo26 benchmark test data comes from the Ultralytics team, which tested models in many different formats (the data is for reference only).

According to the test parameters of the different model formats provided by the Ultralytics team, we can see that the inference performance is the best when TensorRT is used!
Reference link:
https://docs.ultralytics.com/guides/nvidia-jetson
2. Enable the best performance of the mainboard
2.1. Enable the MAX power mode
Enabling the MAX Power Mode (the maximum power mode) on the Jetson ensures that all the CPU and GPU cores are turned on:
xxxxxxxxxxsudo nvpmodel -m 0
2.2. Enable the Jetson clocks
Enabling the Jetson Clocks ensures that all the CPU and GPU cores run at the maximum frequency:
xxxxxxxxxxsudo jetson_clocks
3. Model conversion
The first use of the export mode of yolo26 automatically installs some dependencies, just wait for the automatic completion! Choose either the CLI or the Python method.
3.1. CLI: pt → onnx → engine
Convert the model from the PyTorch format into TensorRT: the conversion process automatically generates the ONNX model
xxxxxxxxxxcd /home/jetson/ultralytics/ultralytics
xxxxxxxxxxyolo export model=yolo26n.pt format=engine# yolo export model=yolo26n-seg.pt format=engine# yolo export model=yolo26n-pose.pt format=engine# yolo export model=yolo26n-cls.pt format=engine# yolo export model=yolo26n-obb.pt format=engine

3.2. Python: pt → onnx → engine
Convert the model from the PyTorch format into TensorRT: the conversion process automatically generates the ONNX model
xxxxxxxxxxcd /home/jetson/ultralytics/ultralytics/yahboom_yolo26
xxxxxxxxxxpython3 model_pt_onnx_engine.py
xfrom ultralytics import YOLO# Load a yolo26n PyTorch model# model = YOLO("/home/jetson/ultralytics/ultralytics/yolo26n.pt")model = YOLO("/home/jetson/ultralytics/ultralytics/yolo26n-seg.pt")# model = YOLO("/home/jetson/ultralytics/ultralytics/yolo26n-pose.pt")# model = YOLO("/home/jetson/ultralytics/ultralytics/yolo26n-cls.pt")# model = YOLO("/home/jetson/ultralytics/ultralytics/yolo26n-obb.pt")# Export the model to TensorRTmodel.export(format="engine")
Note: the model file generated by the conversion is located at the position of the model file that was converted

4. Model prediction
The CLI use
The CLI currently only supports calling the USB camera.
xxxxxxxxxxcd /home/jetson/ultralytics/ultralytics
xxxxxxxxxxyolo predict model=yolo26n.onnx source=0 save=False show

xxxxxxxxxxyolo predict model=yolo26n.engine source=0 save=False show
