I’m using Ultralytics YOLOv11s with two custom classes for object detection and exporting it to ONNX and RKNN formats.
I have followed https://docs.ultralytics.com/integrations/rockchip-rknn/
After conversion, inference on the RKNN based 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
Code used for exporting -
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.
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: shows only 6 channels in the final layer.
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:
- Confirm whether there’s an option/flag in the YOLO-Ultralytics or RKNN export pipeline I’m missing to preserve all classes.
- Suggest any workarounds or patches to ensure correct output-channel dimensionality.
- Identify if this might be a known issue in RKNN-Toolkit 1.5.0 or Ultralytics YOLO v11.
Thank you for your assistance!