RKNN Ultralytics YOLOv11
This document demonstrates how to perform inference for the YOLOv11 object detection model on RK3588/356X. For the required environment setup, please refer to RKNN Installation.
Currently, the Ultralytics library officially supports the RKNN platform. Users of RK3588/356X products can directly use the ultralytics
library for YOLOv11 model conversion and deployment.
Model Conversion on PC
Radxa has provided a pre-converted yolov11n.rknn
model. Users can skip the PC-side model conversion section and directly refer to YOLOv11 Inference on Board.
-
Install the latest version of Ultralytics:
pip3 install -U ultralytics
-
Use Ultralytics to export the YOLOv11 model in RKNN format:
- CLI
- Python
# 'name' can be one of rk3588, rk3576, rk3566, rk3568, rk3562, rv1103, rv1106, rv1103b, rv1106b, rk2118
yolo export model=yolo11n.pt format=rknn name=rk3588from ultralytics import YOLO
# Load the YOLOv11 model
model = YOLO("yolo11n.pt")
# Export the model to RKNN format
# 'name' can be one of rk3588, rk3576, rk3566, rk3568, rk3562, rv1103, rv1106, rv1103b, rv1106b, rk2118
model.export(format="rknn", name="rk3588") # creates '/yolo11n_rknn_model'The result is saved in
./yolo11n_rknn_model
. -
Copy the yolo11n_rknn_model directory to the target device.
YOLOv11 Inference on Board
For users of RK356X products, you need to enable the NPU in the terminal using rsetup before using the NPU: sudo rsetup -> Overlays -> Manage overlays -> Enable NPU
, then restart the system.
If there is no Enable NPU
option in the overlays options, please update the system via: sudo rsetup -> system -> System Update
, restart, and execute the above steps to enable the NPU.
-
(Optional) Download the YOLOv11n RKNN model provided by Radxa:
Platform Download Link rk3566 yolo11n_3566_rknn_model rk3568 yolo11n_3568_rknn_model rk3588 yolo11n_3588_rknn_model -
Install the latest version of Ultralytics in a virtual environment:
For instructions on virtual environments, refer to Python Virtual Environment Usage.
pip3 install -U ultralytics
-
Run inference on the board:
- CLI
- Python
yolo predict model='./yolo11n_rknn_model' source='https://ultralytics.com/images/bus.jpg'
from ultralytics import YOLO
# Load the exported RKNN model
rknn_model = YOLO("./yolo11n_rknn_model")
# Run inference
results = rknn_model("https://ultralytics.com/images/bus.jpg")The results are saved in
runs/detect/predict
.
Additional Usage Details
For more details about using Ultralytics, refer to the Ultralytics official documentation.