Ultralytics YOLO26 모델을 위한 Rockchip RKNN 내보내기

임베디드 디바이스, 특히 Rockchip 프로세서를 탑재한 디바이스에 컴퓨터 비전 모델을 배포할 때는 호환되는 모델 형식이 필수적입니다. Ultralytics YOLO26 모델을 RKNN 형식으로 내보내면 Rockchip 하드웨어에 최적화된 성능과 호환성을 확보할 수 있습니다. 이 가이드에서는 Rockchip 플랫폼에 효율적으로 배포하기 위해 부동 소수점 및 INT8 양자화 내보내기를 포함하여 YOLO26 모델을 RKNN 형식으로 변환하는 방법을 설명합니다.

Rockchip RKNN export for NPU deployment

참고

이 가이드는 Rockchip RK3588 기반의 Radxa Rock 5B와 Rockchip RK3566 기반의 Radxa Zero 3W에서 테스트되었습니다. RK3576, RK3568, RK3562, RK2118, RV1126B, RV1103, RV1106, RV1103B, RV1106B 등 rknn-toolkit2를 지원하는 다른 Rockchip 기반 디바이스에서도 작동할 것으로 예상됩니다. RV1103 및 RV1106과 같이 INT8만 지원하는 타깃에는 quantize=8이 필요합니다.

Rockchip이란 무엇인가요?#

Rockchip은 다양한 소비자 가전, 산업용 애플리케이션, AI 제품에 사용되는 전력 효율적인 시스템 온 칩(SoC)을 설계합니다. ARM 기반 아키텍처, 내장 신경망 처리 장치(NPU), 고해상도 멀티미디어 지원을 갖춘 Rockchip SoC는 태블릿, 스마트 TV, IoT 시스템, 엣지 AI 애플리케이션 등의 디바이스에 사용됩니다. Radxa, ASUS, Pine64, Orange Pi, Odroid, Khadas, Banana Pi 등의 기업은 Rockchip SoC 기반의 다양한 제품을 제공합니다.

RKNN Toolkit#

RKNN Toolkit은 Rockchip이 하드웨어 플랫폼에서 딥러닝 모델을 배포할 수 있도록 제공하는 도구 및 라이브러리 모음입니다. RKNN은 Rockchip Neural Network의 약자로, 이러한 도구에서 사용하는 독점 형식입니다. RKNN 모델은 Rockchip의 NPU(신경망 처리 장치)가 제공하는 하드웨어 가속을 최대한 활용하도록 설계되어 RK3588, RK3566, RV1103, RV1106 및 기타 Rockchip 기반 시스템과 같은 기기에서 AI 작업의 고성능을 보장합니다.

RKNN 모델의 주요 기능#

RKNN 모델은 Rockchip 플랫폼에 배포할 때 다음과 같은 여러 이점을 제공합니다.

  • NPU에 최적화: RKNN 모델은 Rockchip의 NPU에서 실행되도록 특별히 최적화되어 성능과 효율성을 극대화합니다.
  • 낮은 지연 시간: RKNN 형식은 추론 지연 시간을 최소화하므로 엣지 디바이스의 실시간 애플리케이션에 매우 중요합니다.
  • 플랫폼별 맞춤화: RKNN 모델은 특정 Rockchip 플랫폼에 맞게 조정할 수 있어 하드웨어 리소스를 더욱 효과적으로 활용할 수 있습니다.
  • 전력 효율성: 전용 NPU 하드웨어를 활용하는 RKNN 모델은 CPU 또는 GPU 기반 처리보다 전력 소모가 적어 휴대용 기기의 배터리 수명을 연장합니다.

Rockchip 하드웨어에 OS 플래시하기#

Rockchip 기반 디바이스를 확보한 후 첫 단계는 하드웨어가 작동 환경으로 부팅되도록 OS를 플래시하는 것입니다. 테스트를 마친 두 디바이스인 Radxa Rock 5B와 Radxa Zero 3W의 시작 가이드는 아래에 링크되어 있습니다.

지원 작업#

RKNN 내보내기는 Ultralytics의 7가지 작업을 모두 지원합니다. 시맨틱 세그멘테이션과 깊이 추정은 해당 헤드를 탑재한 유일한 제품군인 YOLO26에서만 사용할 수 있습니다.

작업YOLOv8YOLO11YOLO26
탐지✅✅✅
세그멘테이션✅✅✅
시맨틱❌❌✅
깊이❌❌✅
분류✅✅✅
포즈✅✅✅
OBB✅✅✅

RKNN으로 내보내기: YOLO26 모델 변환#

Ultralytics YOLO26 모델을 RKNN 형식으로 내보내고 내보낸 모델로 추론을 실행합니다.

참고

Rockchip 기반 기기(ARM64)에서의 내보내기는 지원되지 않으므로, RKNN으로 모델을 내보낼 때는 X86 기반 Linux PC를 사용해야 합니다.

설치#

필수 패키지를 설치하려면 다음을 실행하세요:

설치
# Install the required package for YOLO26
pip install ultralytics

설치 절차에 대한 자세한 지침과 모범 사례는 Ultralytics 설치 가이드를 참조하세요. YOLO26에 필요한 패키지를 설치하는 중 문제가 발생하면 해결 방법과 팁을 확인할 수 있는 일반적인 문제 가이드를 참조하세요.

사용법#

참고

모든 작업에서 FP16 및 INT8 내보내기를 지원합니다. FP16을 지원하는 대상용 INT8 빌드는 오차가 큰 레이어를 FP16으로 유지하며(RKNN Toolkit auto_hybrid), RV1103 및 RV1106과 같은 INT8 전용 대상에서는 이 단계를 건너뜁니다. Detection, segmentation, pose 및 OBB 모델의 경우 INT8 .rknn 파일은 헤드의 출력 컨볼루션에서 끝나며, 레벨별 헤드 텐서를 원시 형태로 출력합니다. 박스 디코딩은 내보낸 디렉터리의 tail.onnx 파일을 사용해 호스트 CPU에서 부동 소수점 연산으로 수행합니다. Ultralytics는 ONNX Runtime을 사용해 tail.onnx을 실행하며(설치되어 있지 않으면 자동으로 설치됨), 사용자 지정 런타임은 tail.onnx를 실행하거나 동일한 디코딩을 구현해야 합니다. 이전 버전의 Ultralytics로 내보낸 INT8 detection, segmentation, pose 및 OBB 모델은 출력에 입력 기준으로 정규화된 좌표가 포함되어 있고 현재 릴리스에서는 더 이상 좌표를 재조정하지 않으므로 다시 내보내십시오. 모든 작업의 INT8 정확도는 rknn-toolkit2 시뮬레이터로 검증했지만, 아직 Rockchip 하드웨어에서는 검증하지 않았습니다. Depth INT8 빌드는 깊이 맵이 쌍으로 제공되는 depth 데이터셋 이미지로 보정합니다. 배포 장면의 가까운 거리부터 먼 거리까지의 깊이 범위를 포괄하는 보정 이미지를 선택하십시오. 보정 범위를 벗어나는 깊이는 정확도가 떨어지기 때문입니다.

RKNN 형식은 내보내기, 예측, 검증 모드를 지원합니다. 추론 및 검증은 Rockchip NPU 하드웨어에서 실행됩니다. 모델을 내보낸 다음 내보낸 모델을 로드하여 추론을 실행하거나 정확도를 검증합니다. 기본적으로 RKNN 내보내기는 FP16을 지원하는 Rockchip 타깃에서 부동 소수점 빌드 경로(quantize=16)를 사용합니다. 보정 데이터를 사용하여 INT8 양자화된 RKNN 모델을 빌드하려면 quantize=8를 사용합니다. RKNN 내보내기는 별도의 FP32 모드를 제공하지 않으며, 기본 FP16 설정은 FP32를 요청하지 않습니다.

내보내기
from ultralytics import YOLO

# YOLO26 모델을 불러옵니다(지원되는 작업 모델로 바꾸세요).
model = YOLO("yolo26n-obb.pt")

# 모델을 RKNN 형식으로 내보냅니다.
model.export(format="rknn", name="rk3588")  # creates 'yolo26n-obb_rknn_model'

# 보정 데이터를 사용해 INT8 양자화 RKNN 모델 내보내기
model = YOLO("yolo26n.pt")
model.export(format="rknn", name="rk3588", quantize=8, data="coco8.yaml")  # creates 'yolo26n_rknn_model'
예측
from ultralytics import YOLO

# 내보낸 RKNN 모델을 불러옵니다.
model = YOLO("./yolo26n-obb_rknn_model")

# 추론 실행
results = model("https://ultralytics.com/images/boats.jpg")
검증
from ultralytics import YOLO

# 내보낸 RKNN 모델을 불러옵니다.
model = YOLO("./yolo26n-obb_rknn_model")

# DOTA8 데이터셋에서 정확도를 검증합니다.
metrics = model.val(data="dota8.yaml")

내보내기 인수#

인수유형기본값설명
formatstr'rknn'내보낸 모델의 타깃 형식으로, Rockchip 배포 환경과의 호환성을 정의합니다.
imgszint 또는 tuple640모델 입력에 사용할 이미지 크기입니다. 정사각형 이미지에는 정수를 사용하고, 특정 크기에는 튜플 (height, width)을 사용할 수 있습니다.
batchint1내보내기 모델의 배치 추론 크기 또는 predict 모드에서 내보낸 모델이 동시에 처리할 최대 이미지 수를 지정합니다.
namestr'rk3588'Rockchip 타깃을 지정합니다. rk3588, rk3576, rk3566, rk3568, rk3562, rk2118, rv1126b은 FP16(quantize=16 또는 설정하지 않음) 및 INT8(quantize=8)을 지원합니다. rv1103, rv1106, rv1103b, rv1106b는 INT8만 지원합니다(quantize=8 또는 설정하지 않음).
quantizeint 또는 strNone양자화 정밀도: 설정하지 않거나 16을 지정하면 FP16 지원 대상용으로 FP16을 빌드하고, INT8 전용 대상에서는 설정하지 않은 경우 INT8을 자동으로 활성화합니다. 8을 지정하면 INT8을 빌드합니다. RKNN 내보내기에는 별도의 FP32 모드가 없습니다. 이 설정은 더 이상 사용되지 않는 half/int8 플래그를 대체합니다.
simplifyboolTrueonnxslim을 사용하여 중간 ONNX 그래프를 간소화합니다.
opsetintNone중간 ONNX 그래프의 ONNX opset 버전을 지정합니다. 설정하지 않으면 기본값은 19이며, 19보다 큰 값은 19로 낮춰집니다.
datastrNoneINT8 보정에 사용되는 데이터셋 YAML입니다. quantize=8에서 생략하면 Ultralytics는 작업의 기본 데이터셋을 사용합니다(예: 탐지에는 coco8.yaml, 깊이에는 depth8.yaml).
fractionfloat, int 또는 list1.0비율, 이미지 수 또는 [train, val, test] 비율/개수로 지정하는 보정 하위 집합입니다. 항목이 두 개인 목록에서는 test이 전체로 설정되고, 0는 건너뜁니다.
devicestrNone내보내기에 사용할 디바이스를 지정합니다. GPU(device=0) 또는 CPU(device=cpu)입니다.
팁

RKNN으로 내보낼 때는 x86 Linux 머신을 사용하세요.

내보내기 프로세스에 관한 자세한 내용은 내보내기에 관한 Ultralytics 문서 페이지를 참조하세요.

내보낸 YOLO26 RKNN 모델 배포#

Ultralytics YOLO26 모델을 RKNN 형식으로 성공적으로 내보냈다면, 다음 단계는 Rockchip 기반 기기에 모델을 배포하는 것입니다.

설치#

필수 패키지를 설치하려면 다음을 실행하세요:

설치
# Install the required package for YOLO26
pip install ultralytics

설치가 완료되면 위의 사용법 섹션에 나온 대로 Rockchip 기기에서 추론과 검증을 실행합니다. 내보낸 _rknn_model은 YOLO(...)로 바로 불러올 수 있습니다.

참고

RKNN 런타임 버전이 RKNN Toolkit 버전과 일치하지 않아 추론에 실패한다는 로그 메시지가 표시되면 /usr/lib/librknnrt.so을 공식 librknnrt.so 파일로 바꾸세요.

모델 툴킷 버전과 librknnrt 런타임 버전이 일치하지 않는다는 RKNN 로그 경고

실제 애플리케이션#

YOLO26 RKNN 모델을 탑재한 Rockchip 기반 기기는 다음과 같은 다양한 애플리케이션에 사용할 수 있습니다.

  • 스마트 감시: 전력 소모가 적은 효율적인 객체 탐지 시스템을 구축하여 보안 모니터링에 활용합니다.
  • 산업 자동화: 임베디드 기기에서 품질 관리와 결함 탐지를 직접 구현합니다.
  • 리테일 분석: 클라우드에 의존하지 않고 고객 행동과 재고를 실시간으로 추적합니다.
  • 스마트 농업: 농업 분야의 컴퓨터 비전을 사용하여 작물 상태를 모니터링하고 해충을 탐지합니다.
  • 자율 로봇: 리소스가 제한된 플랫폼에서 비전 기반 내비게이션과 장애물 탐지를 구현합니다.

벤치마크#

아래 YOLO26 벤치마크는 Ultralytics 팀이 Rockchip RK3588 기반 Radxa Rock 5B에서 rknn 모델 형식을 사용하여 속도와 정확도를 측정한 결과입니다.

성능
모델형식정밀도상태크기(MB)mAP50-95(B)추론 시간(ms/이미지)
YOLO26nrknnFP16✅7.20.47758.5
YOLO26nrknnINT8✅4.10.46341.2
YOLO26srknnFP16✅21.00.56993.8
YOLO26srknnINT8✅12.00.55461.9
YOLO26mrknnFP16✅43.00.608226.3
YOLO26mrknnINT8✅22.00.603122.0
YOLO26lrknnFP16✅53.00.628264.7
YOLO26lrknnINT8✅28.00.617145.3
YOLO26xrknnFP16✅113.00.664655.4
YOLO26xrknnINT8✅58.00.649287.4

ultralytics 8.4.60으로 벤치마크를 수행했습니다.

참고

위 벤치마크의 검증에는 COCO128 데이터셋을 사용했습니다. 추론 시간에는 전처리 및 후처리 시간이 포함되지 않습니다. 현재 INT8 내보내기 경로(호스트 측 디코딩 및 auto_hybrid)를 Rockchip 하드웨어에서 검증한 뒤 INT8 행을 갱신할 예정입니다.

요약#

이 가이드에서는 Ultralytics YOLO26 모델을 RKNN 형식으로 내보내 Rockchip 플랫폼에 배포하는 방법을 알아보았습니다. 또한 RKNN Toolkit과 엣지 AI 애플리케이션에서 RKNN 모델을 사용할 때의 구체적인 이점도 살펴보았습니다.

Ultralytics YOLO26과 Rockchip의 NPU 기술을 결합하면 임베디드 디바이스에서 고급 컴퓨터 비전 태스크를 실행하는 효율적인 솔루션을 제공합니다. 이 접근 방식은 낮은 전력 소비로 실시간 객체 탐지 및 기타 비전 AI 애플리케이션을 구현합니다.

사용법에 대한 자세한 내용은 RKNN 공식 문서를 참조하세요.

자주 묻는 질문#

  • Ultralytics Python 패키지의 export() 메서드나 명령줄 인터페이스(CLI)를 사용해 Ultralytics YOLO 모델을 RKNN 형식으로 내보낼 수 있습니다. Rockchip과 같은 ARM64 디바이스는 내보내기를 지원하지 않으므로 내보내기 작업에는 x86 기반 Linux PC를 사용해야 합니다. name 인수로 타깃 Rockchip 플랫폼을 지정할 수 있습니다(예: rk3588, rk3566 등). 이 과정을 거치면 Rockchip 디바이스의 신경망 처리 장치(NPU)를 활용해 추론을 가속할 수 있도록 최적화된 RKNN 모델이 생성됩니다.

    예제
    from ultralytics import YOLO
    
    # YOLO 모델을 불러옵니다.
    model = YOLO("yolo26n.pt")
    
    # 특정 Rockchip 플랫폼용으로 RKNN 형식으로 내보냅니다.
    model.export(format="rknn", name="rk3588")
  • RKNN 모델은 Rockchip 신경망 처리 장치(NPU)의 하드웨어 가속 기능을 활용하도록 특별히 설계되었습니다. 따라서 같은 하드웨어에서 ONNX 또는 LiteRT와 같은 일반 모델 형식을 실행할 때보다 추론 속도가 빨라지고 지연 시간이 줄어듭니다. RKNN 모델을 사용하면 디바이스 리소스를 더 효율적으로 활용할 수 있어 전력 소비가 감소하고 전반적인 성능이 향상됩니다. 이는 엣지 디바이스의 실시간 애플리케이션에서 특히 중요합니다. Ultralytics YOLO 모델을 RKNN으로 변환하면 RK3588, RK3566 등을 비롯한 Rockchip SoC 기반 디바이스에서 최적의 성능을 얻을 수 있습니다.

  • RKNN 모델은 Rockchip 플랫폼과 통합 NPU에 맞게 특별히 최적화되어 있습니다. 다른 플랫폼에서 최적의 성능을 얻으려면 Ultralytics YOLO 모델을 해당 플랫폼 전용 형식으로 내보내는 것이 좋습니다. 예를 들어 NVIDIA GPU용 TensorRT 또는 Google Coral 기기용 Edge TPU를 사용할 수 있습니다. Ultralytics는 다양한 하드웨어 가속기와의 호환성을 보장하도록 폭넓은 형식으로 내보내기를 지원합니다.

  • Ultralytics YOLO의 RKNN 형식 내보내기는 RK3588, RK3576, RK3566, RK3568, RK3562, RK2118, RV1126B를 포함한 부동소수점 RKNN 빌드 지원 Rockchip 플랫폼을 지원합니다. 또한 quantize=8을 사용하는 INT8 양자화 RKNN 내보내기도 지원합니다. 이는 RV1103, RV1106, RV1103B, RV1106B와 같은 INT8 전용 타깃에 필요합니다. 이러한 플랫폼은 Radxa, ASUS, Pine64, Orange Pi, Odroid, Khadas, Banana Pi 등의 제조업체 제품에 널리 사용되므로, 단일 보드 컴퓨터부터 산업용 시스템까지 다양한 Rockchip 기반 기기에 최적화된 RKNN 모델을 배포할 수 있습니다.

  • RKNN 모델은 Rockchip NPU에 최적화되어 있으므로 일반적으로 Rockchip 디바이스에서 ONNX 또는 LiteRT와 같은 다른 형식보다 성능이 뛰어납니다. 예를 들어 Radxa Rock 5B (RK3588)의 벤치마크에서 RKNN 형식의 YOLO26n은 FP16에서 이미지당 추론 시간 58.5ms, INT8에서 41.2ms를 기록했습니다. 모든 YOLO26 모델 크기의 결과는 벤치마크 섹션에 나와 있습니다. 전용 NPU 하드웨어에서 실행되는 RKNN 모델은 Rockchip 기반 엣지 디바이스의 실시간 애플리케이션에서 지연 시간을 최소화하고 처리량을 극대화합니다.

댓글45

질문을 하거나 결과를 공유하거나 다른 사람을 도와주세요.

  1. as-jacksonGitHub

    We are pleased to confirm that the following ArmSoM boards based on Rockchip RK3576 have been successfully tested with Ultralytics projects (e.g., YOLO11n):

    ArmSoM-Sige5 ArmSoM-CM5

    Validation Scope:

    Model training/inference pipeline

    1
  2. yizi72GitHub

    I tried to convert the yolo11n.pt into a rknn model through codes below: from ultralytics import YOLO model = YOLO("yolo11n.pt") model.export(format="rknn", name="rk3588") and everything went correct. A rknn model named yolo11n-rk3588.rknn was build and used to infer a very traditional yolo demo image "bus"(a blue bus with several people in front of it), but no detection result was obtained.

    I tried to convert the yolol11n.pt into onnx model through above codes firstly, and then used a convert.py offered by rknn_model_zoo/examples/yolo11/python,

    import sys from rknn.api import RKNN

    DATASET_PATH = '../../../datasets/COCO/coco_subset_20.txt' DEFAULT_RKNN_PATH = '/home/yizi/model/yolo11/yolodet.rknn' DEFAULT_QUANT = False

    def parse_arg(): if len(sys.argv) < 3: print("Usage: python3 {} onnx_model_path [platform] [dtype(optional)] [output_rknn_path(optional)]".format(sys.argv[0])) print(" platform choose from [rk3562,rk3566,rk3568,rk3588,rk3576,rk1808,rv1109,rv1126]") print(" dtype choose from [i8, fp] for [rk3562,rk3566,rk3568,rk3588,rk3576]") print(" dtype choose from [u8, fp] for [rk1808,rv1109,rv1126]") exit(1)

    model_path = sys.argv[1]
    platform = sys.argv[2]
    
    do_quant = DEFAULT_QUANT
    if len(sys.argv) > 3:
        model_type = sys.argv[3]
        if model_type not in ['i8', 'u8', 'fp']:
            print("ERROR: Invalid model type: {}".format(model_type))
            exit(1)
        elif model_type in ['i8', 'u8']:
            do_quant = True
        else:
            do_quant = False
    
    if len(sys.argv) > 4:
        output_path = sys.argv[4]
    else:
        output_path = DEFAULT_RKNN_PATH
    
    return model_path, platform, do_quant, output_path

    if name == 'main': model_path, platform, do_quant, output_path = parse_arg()

    # Create RKNN object
    rknn = RKNN(verbose=False)
    
    # Pre-process config
    print('--> Config model')
    rknn.config(mean_values=[[0, 0, 0]], std_values=[[255, 255, 255]], target_platform=platform)
    print('done')
    
    # Load model
    print('--> Loading model')
    ret = rknn.load_onnx(model=model_path)
    if ret != 0:
        print('Load model failed!')
        exit(ret)
    print('done')
    
    # Build model
    print('--> Building model')
    ret = rknn.build(do_quantization=do_quant, dataset=DATASET_PATH)
    if ret != 0:
        print('Build model failed!')
        exit(ret)
    print('done')
    
    # Export rknn model
    print('--> Export rknn model')
    ret = rknn.export_rknn(output_path)
    if ret != 0:
        print('Export rknn model failed!')
        exit(ret)
    print('done')
    
    # Release
    rknn.release()

    Still everything went correct. A rknn model was created and applied to "bus.jpg", and there was no detection at all. I wonder what's wrong in the whole process?

    1
    1. Glenn JocherUltralytics

      @yizi72 thanks for the detailed report. For RKNN inference issues with YOLO11, please ensure:

      1. You're using matching RKNN Toolkit and runtime versions (update both if needed)
      2. Input images are 640x640 with pixel values normalized 0-255
      3. You load models via YOLO('./yolo11n_rknn_model') as shown in our RKNN deployment docs

      If issues persist, please share your full environment details and validation results from both export methods.

    2. yizi72GitHub

      1、I used rknn-toolkit2-2.3.0 which is the latest version ,bu I still did "pip install rknn-toolkit2 --upgrade" again. 2、The input image is 640*640, uchar, 0-255. 3. I used the following setting to transfer yolo11n.pt to onnx, from ultralytics import YOLO

      加载一个模型,路径为 YOLO 模型的 .pt 文件

      model = YOLO("yolo11n.pt")

      导出模型,设置多种参数

      model.export( format="onnx", imgsz=(640, 640),
      keras=False,
      optimize=True,
      half=False,
      int8=False,
      dynamic=False,
      simplify=True,
      opset=12,
      #workspace=4.0,
      nms=False,
      batch=1
      ) and applied the following codes to verify yolo11n.onnx model:

      from ultralytics import YOLO from PIL import Image

      Load a model

      model = YOLO("/home/yizi/models/yolo11/yolo11n.onnx") # load an official model

      Predict with the model

      results = model("bus.jpg") # predict on an image #results = rknn_model("bus.jpg")

      Access the results

      for result in results: xywh = result.boxes.xywh # center-x, center-y, width, height xywhn = result.boxes.xywhn # normalized xyxy = result.boxes.xyxy # top-left-x, top-left-y, bottom-right-x, bottom-right-y xyxyn = result.boxes.xyxyn # normalized names = [result.names[cls.item()] for cls in result.boxes.cls.int()] # class name of each box confs = result.boxes.conf # confidence score of each box

      The results are good. All objects in bus.jpg were detected. Then I run the following code to transfer onnx to rknn:

      from rknn.api import RKNN import cv2 import numpy as np

      if name == 'main': rknn = RKNN(verbose=True,verbose_file="log.txt") rknn.config( mean_values=[[0, 0, 0]], std_values=[[255, 255, 255]], target_platform="rk3588", optimization_level=3 )

      rknn.load_onnx(
          model="/home/yizi/models/yolo11/yolo11n.onnx",
          input_size_list=[[1,3,640,640]], 

      )

      rknn.build(
          do_quantization=False 
      )
      
      rknn.export_rknn(
          export_path="/home/yizi/models/yolo11/yolo11n.rknn" 
      )
      
      rknn.release()

      The transferring process went smooth, two problems appeared.

      Firstly,when this rknn model was pushed into a rk3588 tablet, and run with a binary executable file generated by cross-compilation, no result was detected.

      Secondly, I tried to run the following codes:

      from ultralytics import YOLO from PIL import Image

      rknn_model = YOLO("/home/yizi/models/yolo11/yolo11n.rknn", task=detect)

      results = model("bus.jpg")

      An error message, "model='/home/yizi/models/yolo11/yolo11n.rknn' is not a supported model format. Ultralytics supports: ('PyTorch', 'TorchScript', 'ONNX', 'OpenVINO', 'TensorRT', 'CoreML', 'TensorFlow SavedModel', 'TensorFlow GraphDef', 'TensorFlow Lite', 'TensorFlow Edge TPU', 'TensorFlow.js', 'PaddlePaddle', 'MNN', 'NCNN', 'IMX', 'RKNN') See https://docs.ultralytics.com/modes/predict for help. " appeared.

      Last question, how many outputs does yolo11 yield? one or six?

    3. Glenn JocherUltralytics

      @yizi72 thank you for the detailed report. For RKNN deployment issues:

      1. When using Ultralytics RKNN export, load models via the exported directory (not .rknn file), as shown in our RKNN deployment docs:
      model = YOLO('./yolo11n_rknn_model')  # directory path
      1. Ensure your RK3588 runtime uses matching librknnrt.so versions with your RKNN Toolkit 2.3.0 installation

      2. YOLO11 detection models output 3 tensors by default (different from older YOLO versions). For conversion issues, we recommend using our native model.export(format='rknn') rather than manual ONNX conversion.

      Let me know if you still face issues after verifying these points.

    4. yizi72GitHub

      Thanks for replies. I did verify all points you've mentioned above. When running model("bus.jpg"), error messages show:

      File "/home/yizi/anaconda3/envs/rknn/lib/python3.9/site-packages/ultralytics/engine/model.py", line 182, in call return self.predict(source, stream, **kwargs) File "/home/yizi/anaconda3/envs/rknn/lib/python3.9/site-packages/ultralytics/engine/model.py", line 543, in predict self.predictor.setup_model(model=self.model, verbose=is_cli) File "/home/yizi/anaconda3/envs/rknn/lib/python3.9/site-packages/ultralytics/engine/predictor.py", line 378, in setup_model self.model = AutoBackend( File "/home/yizi/anaconda3/envs/rknn/lib/python3.9/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context return func(*args, **kwargs) File "/home/yizi/anaconda3/envs/rknn/lib/python3.9/site-packages/ultralytics/nn/autobackend.py", line 495, in init raise OSError("RKNN inference is only supported on Rockchip devices.") OSError: RKNN inference is only supported on Rockchip devices.

      It's very strange because I did connect a RK3588 tablet with my virtual machine.

      I still have a quesiton on yolo11n output: yolo11n.pt has one output with shape (1, 84, 8400), and yolo11n-rk3588.rknn has one output with shape (1,84, 8400, 0). Are they correct? If so, can I use the similar codes to analyze rknn output, such as :

      for result in results: xywh = result.boxes.xywh # center-x, center-y, width, height xywhn = result.boxes.xywhn # normalized xyxy = result.boxes.xyxy # top-left-x, top-left-y, bottom-right-x, bottom-right-y xyxyn = result.boxes.xyxyn # normalized names = [result.names[cls.item()] for cls in result.boxes.cls.int()] # class name of each box confs = result.boxes.conf

    5. Glenn JocherUltralytics

      @yizi72 thanks for the details. For the RKNN inference error: ensure your Python script is running directly on the RK3588 hardware (not through a VM) as RKNN models require native Rockchip NPU access. Regarding outputs, YOLO11 detection models produce 3 output tensors by default (see our RKNN deployment docs), but your code should work if using the exported RKNN directory with the included postprocessing. Let me know if you still face issues after verifying native hardware execution.

  3. Yufeng Wu

    Hello, Ultralytics team. I wonder if it's possible to port yolo26n-pose to rknn? I'm not sure if it's difficult to work out on my own? Is there any model architecture problems that prevent porting the pose models to rknn?

  4. montemadjoGitHub

    It appears it does not support rv1106 platform yet

    When I try to export the model using this command

    model.export(format="rknn", name="rv1106", imgsz=320)

    It gives the following error

    E build: Current target_platform(rv1106) not support do_quantization = False!
    E export_rknn: RKNN model does not exist, please load & build model first!

    🤔

    1. Glenn JocherUltralytics(수정됨)

      rv1106 is an INT8-only target, so it needs a quantized RKNN build. Older Ultralytics releases always built with do_quantization=False, which fails with the message you saw. Current releases support it: upgrade with pip install -U ultralytics and export with quantize=8 plus calibration data:

      model.export(format="rknn", name="rv1106", imgsz=320, quantize=8, data="coco8.yaml")

      See the Rockchip RKNN export guide. If it still fails, share your !yolo checks output and rknn-toolkit2 version here and we can sanity-check the environment.

      1
    2. montemadjoGitHub(수정됨)

      Here's the quick workaround for those who want to work with yolo26 on RV1106 chip (like Luckfox pico etc). I ran into a couple of issues there, including quantization erasing my confidence results.

      Long story short - first you need to monkey-patch head.Detect.forward function in order to get two tensors - one for bboxes and one for scores. That way you escape all the heavy non-supported tensor functions. Then you export your yolo26 model to onnx format and finally to rknn like this

      import torch
      from ultralytics.nn.modules import head
      
      # 1. First we monkey-patch the forward function
      def patched_forward(self, x):
          if self.end2end:
              h = self.one2one
          else:
              h = self.one2many
      
          box_head = h["box_head"]
          cls_head = h["cls_head"]
      
          if box_head is None or cls_head is None:
              raise RuntimeError("Head moduls are None")
      
          bs = x[0].shape[0]
          boxes = torch.cat([box_head[i](x[i]).view(bs, 4 * self.reg_max, -1) for i in range(self.nl)], dim=-1)
          scores = torch.cat([cls_head[i](x[i]).view(bs, self.nc, -1) for i in range(self.nl)], dim=-1)
      
          preds = {"boxes": boxes, "scores": scores, "feats": x}
          y = self._inference(preds)
      
          # We are splitting into 2 tensors - both gets its own scale/zp at INT8 quantization
          bboxes = y[:, :4, :]   # [1, 4, 2100] — range 0-640
          scores = y[:, 4:, :]   # [1, 1, 2100] — range 0-1 (already sigmoid-ed)
          score_max_idx = scores[0, 0, :].argmax()
          return bboxes, scores
      
      head.Detect.forward = patched_forward
      
      # 2. Then we export to onnx model (we got best.pt model from ultralytics platform)
      from ultralytics import YOLO
      model = YOLO("best.pt")
      model.export(format="onnx", dynamic=False, opset=12, imgsz=320)
      
      # 3. Then we export to RKNN format
      from rknn.api import RKNN
      
      rknn = RKNN()
      
      # 3.1. Konfiguracija specifična za RV1106
      rknn.config(
          mean_values=[[0, 0, 0]], 
          std_values=[[255, 255, 255]], 
          target_platform='rv1106',
          quantized_algorithm='normal', # Ili 'mmse' za bolju preciznost
          quantized_dtype='asymmetric_quantized-8'
      )
      
      # 3.2. Load the ONNX model
      print("Loading ONNX model...")
      rknn.load_onnx(model='best.onnx')
      
      # 3.3. Build modela sa INT8 kvantizacijom
      # calib.txt should contain paths to calibration images
      print("Building RKNN model with quantization...")
      rknn.build(do_quantization=True, dataset='./calib.txt')
      
      # 3.4. Exporting final .rknn file
      print("Exporting RKNN model...")
      rknn.export_rknn('./yolo26_rv1106_model_optimized.rknn')
      
      rknn.release()

      After this you need to postprocess those two outputs like this

      yolo26_postprocess.h

      /**
       * YOLO26 Post-processing header for Fish Counter
       *
       * Supports YOLO26 2-output format: boxes [1, 4, N] + scores [1, nc, N]
       *
       * Based on the working rknn_minimal_test example.
       */
      
      #ifndef _YOLO26_POSTPROCESS_H_
      #define _YOLO26_POSTPROCESS_H_
      
      #include <stdint.h>
      #include <vector>
      #include "rknn_api.h"
      #include "rknn_detector.h"
      
      // YOLO26 model configuration defaults
      #define YOLO26_CONF_THRESHOLD 0.25f
      #define YOLO26_NMS_THRESHOLD 0.45f
      
      // Detection result (same structure as postprocess.h for compatibility)
      typedef struct
      {
          float x1, y1, x2, y2; // Bounding box (in model coordinates)
          float confidence;
          int class_id;
      } yolo26_detection_t;
      
      // YOLO26 context for format detection and caching
      typedef struct
      {
          int num_predictions;
          int num_classes;
          bool boxes_transposed; // true = [1, 4, N], false = [1, N, 4]
      } yolo26_context_t;
      
      /**
       * Initialize YOLO26 post-processing
       * Detects the output format from model attributes
       *
       * @param app_ctx The RKNN app context with model info
       * @param yolo26_ctx Output: YOLO26 context for format info
       * @return 0 on success, -1 on error
       */
      int yolo26_init_postprocess(rknn_app_context_t *app_ctx, yolo26_context_t *yolo26_ctx);
      
      /**
       * Deinitialize YOLO26 post-processing
       */
      void yolo26_deinit_postprocess();
      
      /**
       * YOLO26 post_process: processes model outputs and returns detections
       * Uses 2-output format: boxes [1, 4, N] + scores [1, nc, N]
       *
       * @param app_ctx The RKNN app context
       * @param yolo26_ctx YOLO26 context from init
       * @param outputs Pointer to output tensor memory array
       * @param letter_box Letterbox transform info for coordinate mapping
       * @param conf_threshold Confidence threshold
       * @param nms_threshold NMS threshold
       * @param od_results Output: detection results (compatible with existing code)
       * @return 0 on success, -1 on error
       */
      int yolo26_post_process(rknn_app_context_t *app_ctx, yolo26_context_t *yolo26_ctx,
                              void *outputs, letterbox_t *letter_box,
                              float conf_threshold, float nms_threshold,
                              object_detect_result_list *od_results);
      
      #endif // _YOLO26_POSTPROCESS_H_

      yolo26_postprocess.cc

      /**
       * YOLO26 Post-processing for Fish Counter on RV1106
       *
       * Supports YOLO26 2-output format: boxes [1, 4, N] + scores [1, nc, N]
       *
       * Based on the working rknn_minimal_test example.
       */
      
      #include "yolo26_postprocess.h"
      
      #include <math.h>
      #include <stdint.h>
      #include <stdio.h>
      #include <stdlib.h>
      #include <string.h>
      #include <algorithm>
      #include <vector>
      
      // Clamp value to range
      inline static int clamp(float val, int min, int max)
      {
          return val > min ? (val < max ? val : max) : min;
      }
      
      // Dequantize INT8 to float
      static inline float dequantize(int8_t qnt, int32_t zp, float scale)
      {
          return ((float)qnt - (float)zp) * scale;
      }
      
      // Sigmoid function
      static inline float sigmoid(float x)
      {
          return 1.0f / (1.0f + expf(-x));
      }
      
      // Calculate IoU between two boxes
      static float calculate_iou(float x1_a, float y1_a, float x2_a, float y2_a,
                                 float x1_b, float y1_b, float x2_b, float y2_b)
      {
          float x1 = std::max(x1_a, x1_b);
          float y1 = std::max(y1_a, y1_b);
          float x2 = std::min(x2_a, x2_b);
          float y2 = std::min(y2_a, y2_b);
      
          float inter_w = std::max(0.0f, x2 - x1);
          float inter_h = std::max(0.0f, y2 - y1);
          float inter_area = inter_w * inter_h;
      
          float area_a = (x2_a - x1_a) * (y2_a - y1_a);
          float area_b = (x2_b - x1_b) * (y2_b - y1_b);
          float union_area = area_a + area_b - inter_area;
      
          return union_area > 0 ? inter_area / union_area : 0;
      }
      
      // Non-Maximum Suppression for YOLO26 detections
      static std::vector<yolo26_detection_t> yolo26_nms(std::vector<yolo26_detection_t> &detections, float nms_threshold)
      {
          // Sort by confidence (descending)
          std::sort(detections.begin(), detections.end(),
                    [](const yolo26_detection_t &a, const yolo26_detection_t &b)
                    { return a.confidence > b.confidence; });
      
          std::vector<yolo26_detection_t> result;
          std::vector<bool> suppressed(detections.size(), false);
      
          for (size_t i = 0; i < detections.size(); i++)
          {
              if (suppressed[i])
                  continue;
      
              result.push_back(detections[i]);
      
              for (size_t j = i + 1; j < detections.size(); j++)
              {
                  if (suppressed[j])
                      continue;
      
                  // Only suppress same class
                  if (detections[i].class_id != detections[j].class_id)
                      continue;
      
                  float iou = calculate_iou(
                      detections[i].x1, detections[i].y1, detections[i].x2, detections[i].y2,
                      detections[j].x1, detections[j].y1, detections[j].x2, detections[j].y2);
      
                  if (iou > nms_threshold)
                  {
                      suppressed[j] = true;
                  }
              }
          }
      
          return result;
      }
      
      // Parse YOLO26 2-output format: boxes [1, 4, N] + scores [1, nc, N]
      static std::vector<yolo26_detection_t> parse_yolo26_2output(
          rknn_tensor_mem **output_mems,
          rknn_tensor_attr *output_attrs,
          int model_width, int model_height,
          float conf_threshold, int num_classes,
          bool boxes_transposed)
      {
          std::vector<yolo26_detection_t> detections;
      
          int8_t *boxes_data = (int8_t *)output_mems[0]->virt_addr;
          int32_t boxes_zp = output_attrs[0].zp;
          float boxes_scale = output_attrs[0].scale;
      
          int8_t *scores_data = (int8_t *)output_mems[1]->virt_addr;
          int32_t scores_zp = output_attrs[1].zp;
          float scores_scale = output_attrs[1].scale;
      
          // Determine number of anchors
          int num_anchors;
          if (boxes_transposed)
          {
              num_anchors = output_attrs[0].dims[2];
          }
          else
          {
              num_anchors = output_attrs[0].dims[1];
          }
      
          // Check if scores are already sigmoid or logits
          float scores_min = 9999, scores_max = -9999;
          for (int i = 0; i < (int)output_attrs[1].n_elems; i++)
          {
              float val = dequantize(scores_data[i], scores_zp, scores_scale);
              if (val < scores_min)
                  scores_min = val;
              if (val > scores_max)
                  scores_max = val;
          }
          bool scores_are_sigmoid = (scores_min >= -0.1f && scores_max <= 1.1f);
      
          for (int i = 0; i < num_anchors; i++)
          {
              // Get box coordinates
              float x1, y1, x2, y2;
              if (boxes_transposed)
              {
                  // [1, 4, N] - channel first
                  x1 = dequantize(boxes_data[0 * num_anchors + i], boxes_zp, boxes_scale);
                  y1 = dequantize(boxes_data[1 * num_anchors + i], boxes_zp, boxes_scale);
                  x2 = dequantize(boxes_data[2 * num_anchors + i], boxes_zp, boxes_scale);
                  y2 = dequantize(boxes_data[3 * num_anchors + i], boxes_zp, boxes_scale);
              }
              else
              {
                  // [1, N, 4] - anchor first
                  x1 = dequantize(boxes_data[i * 4 + 0], boxes_zp, boxes_scale);
                  y1 = dequantize(boxes_data[i * 4 + 1], boxes_zp, boxes_scale);
                  x2 = dequantize(boxes_data[i * 4 + 2], boxes_zp, boxes_scale);
                  y2 = dequantize(boxes_data[i * 4 + 3], boxes_zp, boxes_scale);
              }
      
              // Check if format is xywh instead of xyxy
              if (x2 < x1 || y2 < y1)
              {
                  // Assume xywh format: convert to xyxy
                  float cx = x1, cy = y1, w = x2, h = y2;
                  x1 = cx - w / 2.0f;
                  y1 = cy - h / 2.0f;
                  x2 = cx + w / 2.0f;
                  y2 = cy + h / 2.0f;
              }
      
              // Find max class score
              float max_score = -9999;
              int max_class = 0;
              for (int c = 0; c < num_classes; c++)
              {
                  float score;
                  if (boxes_transposed)
                  {
                      // [1, nc, N]
                      score = dequantize(scores_data[c * num_anchors + i], scores_zp, scores_scale);
                  }
                  else
                  {
                      // [1, N, nc]
                      score = dequantize(scores_data[i * num_classes + c], scores_zp, scores_scale);
                  }
      
                  if (!scores_are_sigmoid)
                  {
                      score = sigmoid(score);
                  }
      
                  if (score > max_score)
                  {
                      max_score = score;
                      max_class = c;
                  }
              }
      
              if (max_score < conf_threshold)
                  continue;
      
              // Clamp to model bounds
              x1 = std::max(0.0f, std::min(x1, (float)model_width));
              y1 = std::max(0.0f, std::min(y1, (float)model_height));
              x2 = std::max(0.0f, std::min(x2, (float)model_width));
              y2 = std::max(0.0f, std::min(y2, (float)model_height));
      
              // Skip invalid boxes
              if (x2 <= x1 || y2 <= y1)
                  continue;
      
              yolo26_detection_t det;
              det.x1 = x1;
              det.y1 = y1;
              det.x2 = x2;
              det.y2 = y2;
              det.confidence = max_score;
              det.class_id = max_class;
      
              detections.push_back(det);
          }
      
          return detections;
      }
      
      int yolo26_init_postprocess(rknn_app_context_t *app_ctx, yolo26_context_t *yolo26_ctx)
      {
          if (!app_ctx || !yolo26_ctx)
          {
              printf("[YOLO26] ERROR: Invalid parameters\n");
              return -1;
          }
      
          memset(yolo26_ctx, 0, sizeof(yolo26_context_t));
      
          int n_output = app_ctx->io_num.n_output;
      
          printf("[YOLO26] Initializing 2-output format (%d outputs)...\n", n_output);
      
          // Print output tensor info
          for (int i = 0; i < n_output; i++)
          {
              printf("  Output %d: dims=[%d,%d,%d,%d], size=%d\n", i,
                     app_ctx->output_attrs[i].dims[0],
                     app_ctx->output_attrs[i].dims[1],
                     app_ctx->output_attrs[i].dims[2],
                     app_ctx->output_attrs[i].dims[3],
                     app_ctx->output_attrs[i].size);
          }
      
          if (n_output != 2)
          {
              printf("[YOLO26] ERROR: Expected 2 outputs (boxes + scores), got %d\n", n_output);
              return -1;
          }
      
          // Parse 2-output format: boxes + scores
          int boxes_dim1 = app_ctx->output_attrs[0].dims[1];
          int boxes_dim2 = app_ctx->output_attrs[0].dims[2];
          int scores_dim1 = app_ctx->output_attrs[1].dims[1];
          int scores_dim2 = app_ctx->output_attrs[1].dims[2];
      
          if (boxes_dim1 == 4)
          {
              // [1, 4, N] boxes format
              yolo26_ctx->num_predictions = boxes_dim2;
              yolo26_ctx->boxes_transposed = true;
              yolo26_ctx->num_classes = scores_dim1;
              printf("[YOLO26] Format: boxes [1,4,%d], scores [1,%d,%d]\n",
                     boxes_dim2, scores_dim1, scores_dim2);
          }
          else if (boxes_dim2 == 4)
          {
              // [1, N, 4] boxes format
              yolo26_ctx->num_predictions = boxes_dim1;
              yolo26_ctx->boxes_transposed = false;
              yolo26_ctx->num_classes = scores_dim2;
              printf("[YOLO26] Format: boxes [1,%d,4], scores [1,%d,%d]\n",
                     boxes_dim1, scores_dim1, scores_dim2);
          }
          else
          {
              printf("[YOLO26] ERROR: Invalid boxes dimensions [1,%d,%d], expected [1,4,N] or [1,N,4]\n",
                     boxes_dim1, boxes_dim2);
              return -1;
          }
      
          printf("[YOLO26] Predictions: %d, Classes: %d\n",
                 yolo26_ctx->num_predictions, yolo26_ctx->num_classes);
      
          return 0;
      }
      
      void yolo26_deinit_postprocess()
      {
          // Nothing to cleanup currently
      }
      
      int yolo26_post_process(rknn_app_context_t *app_ctx, yolo26_context_t *yolo26_ctx,
                              void *outputs, letterbox_t *letter_box,
                              float conf_threshold, float nms_threshold,
                              object_detect_result_list *od_results)
      {
          if (!app_ctx || !yolo26_ctx || !outputs || !letter_box || !od_results)
          {
              return -1;
          }
      
          rknn_tensor_mem **output_mems = (rknn_tensor_mem **)outputs;
      
          int model_width = app_ctx->model_width;
          int model_height = app_ctx->model_height;
      
          // Parse 2-output format
          std::vector<yolo26_detection_t> raw_detections = parse_yolo26_2output(
              output_mems,
              app_ctx->output_attrs,
              model_width, model_height,
              conf_threshold,
              yolo26_ctx->num_classes > 0 ? yolo26_ctx->num_classes : 1,
              yolo26_ctx->boxes_transposed);
      
          // Apply NMS
          std::vector<yolo26_detection_t> final_detections = yolo26_nms(raw_detections, nms_threshold);
      
          // Convert to output format with letterbox coordinate mapping
          memset(od_results, 0, sizeof(object_detect_result_list));
          int count = 0;
      
          for (const auto &det : final_detections)
          {
              if (count >= OBJ_NUMB_MAX_SIZE)
                  break;
      
              // Map coordinates back to original image space
              float x1 = det.x1 - letter_box->x_pad;
              float y1 = det.y1 - letter_box->y_pad;
              float x2 = det.x2 - letter_box->x_pad;
              float y2 = det.y2 - letter_box->y_pad;
      
              // Scale back to original coordinates
              od_results->results[count].box.left = (int)(clamp(x1, 0, model_width) / letter_box->scale);
              od_results->results[count].box.top = (int)(clamp(y1, 0, model_height) / letter_box->scale);
              od_results->results[count].box.right = (int)(clamp(x2, 0, model_width) / letter_box->scale);
              od_results->results[count].box.bottom = (int)(clamp(y2, 0, model_height) / letter_box->scale);
              od_results->results[count].prop = det.confidence;
              od_results->results[count].cls_id = det.class_id;
      
              count++;
          }
      
          od_results->count = count;
      
          return 0;
      }

      And you're good to go! 🚀

    3. Glenn JocherUltralytics(수정됨)

      Thanks for sharing this—splitting the head into 2 outputs (boxes + scores) is a sensible RV1106 workaround to keep RKNN-friendly ops and avoid INT8 scale/zero-point coupling issues; just note that monkey-patching head.Detect.forward is inherently version-fragile. Current Ultralytics already provides an INT8 flow for RV1106 via quantize=8 with data= calibration images (see the Rockchip RKNN export guide), so please try that first. If you still need your custom split, open a GitHub issue linking back to this thread and include !yolo checks, your rknn-toolkit2 version, and a minimal calibration set description so we can evaluate it.

    1. Glenn JocherUltralytics

      @Arshapjoy thanks for the detailed info; for YOLO11 detection heads the export output shape is (1, nc + 4, 8400) (4 box coords plus nc class scores), so with 2 classes (1, 6, 8400) is expected and both classes are present, whereas a postprocessor assuming 5 + nc (old YOLO layout with an extra objectness channel) will effectively drop one class. I’d suggest updating your RKNN-side decoder to treat channels [0:4] as [x, y, w, h] and [4:] as class logits for all nc classes; if you still see a true (1, 7, 8400) PyTorch output on the same checkpoint, please share your ultralytics version and yolo checks output so we can dig deeper. The overall YOLO11 head behaviour is also outlined in the YOLO11 model documentation.

      @BakhtiariB the high-level YOLO("./yolo11n_rknn_model") interface is designed to keep preprocessing, NPU inference and postprocessing together, so if you need to run only the core RKNN inference on the NPU while fully controlling pre/post on the CPU you’ll need to load the exported .rknn with Rockchip’s RKNN API directly and implement your own preprocessing and YOLO11 postprocessing around it.

      @dttvn0010 the ~99 ms figure is a conservative end-to-end pipeline measurement on our RK3588 test setup, so seeing ~11 ms from a highly tuned RKNN deployment using all three NPU cores is quite reasonable; if you are open to sharing your exact model variant, quantization mode, input size and NPU core configuration, we can use that to cross-check and better explain the gap between baseline and fully optimized numbers.

      @NikolayKash in practice, large gains like that usually come from combining INT8-quantized RKNN models, all three NPU cores enabled, a suitable input resolution and very lean Python-side pre/postprocessing, so it would be great if @dttvn0010 can share their exact script and RK3588 configuration for others to replicate.

  5. guojieliGitHub

    he YOLO11 benchmark was run by the Ultralytics team on a Radxa Rock 5B based on the Rockchip RK3588, using the RKNN model format to evaluate speed and accuracy. Could you please clarify whether this was an INT8-quantized model?

  6. ArshapjoyGitHub

    Exported RKNN/ONNX model only has 1 output class instead of 2


    Overview

    I’m using Ultralytics YOLOv11s with two custom classes and exporting it to ONNX and RKNN formats. After conversion, inference on the RKNN device only detects a single class, and the output tensor shape is (1, 6, 8400) instead of the expected (1, 7, 8400). I’ve validated that the source .pt model correctly reports 2 classes, but both ONNX and RKNN exports drop one class.


    Model Details

    • Checkpoint path: path/to/yolo11s_custom.pt
    • Number of classes: 2
    • Input size: 640×640

    from ultralytics import YOLO

    Load the YOLO11 model

    model = YOLO("custom_yolo11s.pt")

    Export the model to RKNN format

    rknn_path = model.export(format="rknn", name="rk3588") print(f"RKNN model saved to: {rknn_path}")

    Actual Behavior

    • Received ONNX , RKNN and metadata.yaml after conversion
    • Exported ONNX model output shape: (1, 6, 8400)
    • Exported RKNN model output shape: (1, 6, 8400)
    • Only one class is detected during inference on the RK3588 board.

    7. Logs & Metadata

    • metadata.yaml generated alongside the RKNN model:
      model:
        name: yolo11s_custom
        format: rknn
        input_shape: [1, 3, 640, 640]
        output_shape: [1, 6, 8400]
      classes: 2
    • ONNX graph info: Attached minimal onnx.shape_inference log shows only 6 channels in the final layer.

    8. Additional Notes

    • Manual ONNX export yields the same issue, so it’s unlikely to be an Ultralytics export bug alone.
    • I’ve confirmed that the PyTorch forward pass on the .pt checkpoint produces a shape (1, 7, 8400).

    9. Request Could you please:

    1. Confirm whether there’s an option/flag in the YOLO-Ultralytics or RKNN export pipeline I’m missing to preserve all classes.
    2. Suggest any workarounds or patches to ensure correct output-channel dimensionality.
    3. Identify if this might be a known issue in RKNN-Toolkit 1.5.0 or Ultralytics YOLO v11.

    Thank you for your assistance!

  7. WeiIIzzGitHub

    Hello, when I exported the rknn model, I performed int8 quantization, but I had an error like this: E build: If set do_quantization = True, dataset file need be provided. But it`s value is None! E export_rknn: RKNN model does not exist, please load build model first! My export code is: from ultralytics import YOLO

    model = YOLO("/home/ky/dfxw/runs/detect/train3/weights/best.pt") model.export(format="rknn", name="rk3576", int8=True, data="/home/ky/rknn_yolo_test/data.yaml") The path pointed to by data is the same as the training dataset. How to solve it

    1. WeiIIzzGitHub

      The content of data.yaml is as follows path: /home/ky/dfxw/split_jiaqian # dataset root dir train: images/train val: images/val

      names: 0: 0 1: 1

    2. Glenn JocherUltralytics(수정됨)

      @WeiIIzz INT8 export for RKNN is supported with quantize=8 (it replaces the deprecated int8=True) together with data pointing to a dataset YAML, which Ultralytics converts into the calibration image list that RKNN needs:

      from ultralytics import YOLO
      
      model = YOLO("/home/ky/dfxw/runs/detect/train3/weights/best.pt")
      model.export(format="rknn", name="rk3576", quantize=8, data="/home/ky/rknn_yolo_test/data.yaml")

      The error you saw comes from an older version that did not pass a calibration dataset to RKNN, so run pip install -U ultralytics and retry. Make sure the YAML points to existing images. Let us know if this resolves your issue!

    3. WeiIIzzGitHub

      @glenn-jocher I followed your steps to modify the code as follows. But I still encountered the same problem.

      from ultralytics import YOLO
      
      model = YOLO("/home/ky/dfxw/runs/detect/train3/weights/best.pt")
      model.export(format="rknn", name="rk3576", int8=True, data="/home/ky/rknn_yolo_test/images")

      Is there only images in the data path?

    4. Glenn JocherUltralytics(수정됨)

      @WeiIIzz older releases ignored int8=True for RKNN and built the model without quantization. Current Ultralytics supports INT8 RKNN export, so after pip install -U ultralytics you can export with:

      model.export(format="rknn", name="rk3576", quantize=8, data="data.yaml")

      Here data is used for the calibration images. Without quantize, the export builds a floating-point (FP16) model.

  8. VictorAbobaGitHub

    Good day,

    Is RKNN available for obb tasks? I tried to use it directly, but got an error saying that some operations (cos) are not available in RKNN. As a fix, RKNN suggested adding disable_rules = ['reduce_reshape_op_around_concat'] to my configuration. I actually did this inside the YOLO library. Model was exported first to ONNX and then from ONNX to RKNN works and returns the responses in the format (1,6,21504), which seems what I expected. However, if I use this model through YOLO ("path_to_rknn_model", task = 'obb'), will I still get the results in the standard YOLO format? I just don't want to prescribe pre - and post-processing on my own :)

    Thank you!

    1. Glenn JocherUltralytics(수정됨)

      @VictorAboba thank you for your question! RKNN export now supports all seven Ultralytics tasks, including OBB, so you can export OBB models directly with format="rknn" and load the exported _rknn_model directory with YOLO(...) to get standard YOLO results without writing your own pre- and post-processing. See the Rockchip RKNN guide for details.

    2. SpidrreGitHub

      Hey! Did you notice any significant decrease in quality of your model after conversion? I am also trying to find a way to convert from OBB onnx to RKNN without 'reduce_reshape_op_around_concat'.

    3. VictorAbobaGitHub

      Hey! Did you notice any significant decrease in quality of your model after conversion? I am also trying to find a way to convert from OBB onnx to RKNN without 'reduce_reshape_op_around_concat'.

      Hello, after @glenn-jocher answer, I didn't attempt to convert the OBB model. We have a few other models, and all of them except YOLO were converted to the RKNN format. We will try using this stuff (YOLO without an NPU and others with it) ^_^ After conversion, the OCR model, for example, has almost the same quality, but it doesn't need 'reduce_reshape_op_around_concat' to be used.