RDKX5的TROS部署自己的yolov8输出结构全是F32,该怎么调整?

各位佬好,本萌新最近在尝试将自定义的 YOLOv8 模型(5分类)部署到 RDK 开发板上。目前模型编译成功,但在板端运行推理后处理时遇到了段错误(exit code -11)导致程序崩溃。查了资料感觉是后处理数据类型的问题,特来向大家请教!

我训练出 class=5 的 pt 模型后,使用 rdk_model_zoo-0.0.1-x5\rdk_model_zoo-0.0.1-x5\samples\vision\ultralytics_yolo26\conversion\onnx_export\export_yolo26_detect_bpu.py 导出了 ONNX 文件,然后放进 Docker 环境中使用 hb_mapper 编译。使用的 yaml 如下:
model_parameters:
onnx_model: ‘./best.onnx’
march: “bayes-e”
layer_out_dump: False
working_dir: ‘model_output’
output_model_file_prefix: ‘yolov8_cow’

input_parameters:
input_name: “images”
input_shape: ‘’
input_type_rt: ‘nv12’
input_layout_rt: ‘’
input_type_train: ‘rgb’
input_layout_train: ‘NCHW’
norm_type: ‘data_scale’
scale_value: 0.003921568627451

calibration_parameters:
cal_data_dir: ‘./cal_bin’
cal_data_type: ‘float32’
calibration_type: ‘default’

compiler_parameters:
compile_mode: ‘latency’
debug: False
optimize_level: ‘O3’

编译出 .bin 模型后,在板子上运行报错如下:

root@ubuntu:/home/sunrise/yolov8# ros2 launch dnn_node_example dnn_node_example_feedback.launch.py dnn_example_config_file:=my_config/yolov8workconfig.json dnn_example_image:=my_config/target.jpg^C
root@ubuntu:/home/sunrise/yolov8# ros2 launch dnn_node_example dnn_node_example_feedback.launch.py dnn_example_config_file:=my_config/yolov8workconfig.json dnn_example_image:=my_config/target.jpg
[INFO] [launch]: All log files can be found below /root/.ros/log/2026-04-18-22-38-57-610426-ubuntu-33735
[INFO] [launch]: Default logging verbosity is set to INFO
dnn_node_example_path is /opt/tros/humble/lib/dnn_node_example
cp_cmd is cp -r /opt/tros/humble/lib/dnn_node_example/config .
[INFO] [example-1]: process started with pid [33751]
[example-1] [WARN] [1776523138.204874834] [dnn_example_node]: Parameter:
[example-1] feed_type(0:local, 1:sub): 0
[example-1] image: my_config/target.jpg
[example-1] image_type: 0
[example-1] dump_render_img: 1
[example-1] is_shared_mem_sub: 0
[example-1] config_file: my_config/yolov8workconfig.json
[example-1] msg_pub_topic_name: hobot_dnn_detection
[example-1] info_msg_pub_topic_name: hobot_dnn_detection_info
[example-1] ros_img_topic_name: /image
[example-1] sharedmem_img_topic_name: /hbmem_img
[example-1] [WARN] [1776523138.205612328] [dnn_example_node]: Load [5] class types from file [my_config/cow.list]
[example-1] [WARN] [1776523138.205717077] [dnn_example_node]: Parameter:
[example-1] model_file_name: /home/sunrise/yolov8/cow.bin
[example-1] model_name:
[example-1] [INFO] [1776523138.205791618] [dnn]: Node init.
[example-1] [INFO] [1776523138.205816159] [dnn_example_node]: Set node para.
[example-1] [WARN] [1776523138.205855242] [dnn_example_node]: model_file_name_: /home/sunrise/yolov8/cow.bin, task_num: 4
[example-1] [INFO] [1776523138.205901784] [dnn]: Model init.
[example-1] [BPU_PLAT]BPU Platform Version(1.3.6)! soc info(x5)
[example-1] [HBRT] set log level as 0. version = 3.15.55.0
[example-1] [DNN] Runtime version = 1.24.5_(3.15.55 HBRT)
[example-1] [A][DNN][packed_model.cpp:247]Model [HorizonRT] The model builder version = 1.24.3
[example-1] [INFO] [1776523138.377149435] [dnn]: The model input 0 width is 640 and height is 640
[example-1] [INFO] [1776523138.377310851] [dnn]:
[example-1] Model Info:
[example-1] name: best_bayese_640x640_nv12.
[example-1] [input]
[example-1] - (0) Layout: NCHW, Shape: [1, 3, 640, 640], Type: HB_DNN_IMG_TYPE_NV12.
[example-1] [output]
[example-1] - (0) Layout: NHWC, Shape: [1, 80, 80, 5], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (1) Layout: NHWC, Shape: [1, 80, 80, 64], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (2) Layout: NHWC, Shape: [1, 40, 40, 5], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (3) Layout: NHWC, Shape: [1, 40, 40, 64], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (4) Layout: NHWC, Shape: [1, 20, 20, 5], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (5) Layout: NHWC, Shape: [1, 20, 20, 64], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1]
[example-1] [INFO] [1776523138.377354725] [dnn]: Task init.
[example-1] [INFO] [1776523138.379085794] [dnn]: Set task_num [4]
[example-1] [WARN] [1776523138.379178168] [dnn_example_node]: Get model name: best_bayese_640x640_nv12 from load model.
[example-1] [INFO] [1776523138.379289417] [dnn_example_node]: The model input width is 640 and height is 640
[example-1] [WARN] [1776523138.379340125] [dnn_example_node]: Create ai msg publisher with topic_name: hobot_dnn_detection
[example-1] [INFO] [1776523138.392263055] [dnn_example_node]: Dnn node feed with local image: my_config/target.jpg
[example-1] [INFO] [1776523138.449868477] [dnn_example_node]: Output from frame_id: feedback, stamp: 0.0
[ERROR] [example-1]: process has died [pid 33751, exit code -11, cmd ‘/opt/tros/humble/lib/dnn_node_example/example --ros-args --log-level info --ros-args --params-file /tmp/launch_params_nj7r12bj --params-file /tmp/launch_params_gktcru7_ --params-file /tmp/launch_params_q8oab9hs --params-file /tmp/launch_params_7l8malgt --params-file /tmp/launch_params_925i6xtv’].

其中yolov8workconfig.json 如下
{
“model_file”: “/home/sunrise/yolov8/cow.bin”,
“task_num”: 4,
“dnn_parser”: “yolov8”,
“model_output_count”: 6,
“reg_max”: 16,
“class_num”: 5,
“cls_names_list”: “my_config/cow.list”,
“strides”: [8, 16, 32],
“score_threshold”: 0.25,
“nms_threshold”: 0.7,
“nms_top_k”: 300,
“output_order”: [0,1,2,3,4,5]
}

结合 AI 的提示和查阅资料,我有以下猜测,想请各位佬帮忙指点:!!!

是不是因为官方底层的 C++ yolov8 解析器期望 bbox 分支的输出是 S32(int32),但我用默认 YAML 编译出来的模型全是 F32。是不是底层代码用了 int32 指针去读取浮点数,导致数值巨大从而引发内存越界(-11)崩溃?为什么模型出来全是 F32?
是不是编译器在生成 bin 模型的时候,自动在尾部加上了反量化操作?
我在导出 ONNX 的全程没有修改过 yolov8 源码,是否需要去改动 head.py?

提前感谢各位大佬的解答和救命!

你好!你的问题定位非常准确,核心原因确实是输出数据类型不匹配导致的段错误。

问题结论

你的猜测完全正确:dnn_node_example 的 YOLOv8 parser 底层代码期望 bbox 分支输出是 S32(int32),但你编译出来的模型全是 F32(float32)。当 parser 用 int32 指针读取 float32 数据时,会导致数值解析错误,进而引发内存越界和段错误(exit code -11)。


原因分析

1. 为什么官方模型输出是 S32?

官方的 YOLOv8 模型在导出 ONNX 时,对 bbox 分支做了反量化处理,将浮点数输出转换为 int32 格式。这是通过修改 YOLOv8 的 head.py 中的 forward 函数实现的。

2. 你的模型为什么全是 F32?

你使用的 export_yolo26_detect_bpu.py 脚本没有对 bbox 输出进行反量化,导致编译器默认保持 F32 输出。


解决方案

方案一:修改 ONNX 导出脚本(推荐)

需要在导出 ONNX 时,对 bbox 分支添加反量化操作。参考社区已有的 YOLOv8 部署案例,修改你的导出脚本:

步骤 1:找到并修改 Detect_forward 函数

在你的导出脚本中(或参考 rdk_model_zoo 中的示例),需要添加类似以下的反量化逻辑:

def Detect_forward(self, x):
    result = []
    for i in range(self.nl):
        # bbox 分支:添加反量化,将 float 转为 int32
        bbox = self.cv2[i](x[i])  # (B, 4*reg_max, H, W)
        # 关键:对 bbox 输出进行反量化
        bbox = (bbox * 255.0).to(torch.int32)  # 或者使用合适的 scale
        
        # cls 分支:保持 float32
        cls = self.cv3[i](x[i])  # (B, nc, H, W)
        
        # 注意输出顺序:先 bbox 后 cls
        result.append(bbox)
        result.append(cls)
    return result

步骤 2:重新导出 ONNX

cd /path/to/your/export_script
python export_yolo26_detect_bpu.py --pt your_model.pt --imgsz 640 640 --opset 11

步骤 3:验证 ONNX 输出类型

python3 -c "
import onnx
model = onnx.load('best.onnx')
for output in model.graph.output:
    elem_type = output.type.tensor_type.elem_type
    shape = [d.dim_value for d in output.type.tensor_type.shape.dim]
    print(f'{output.name}: shape={shape}, type={elem_type}')
"

期望看到 bbox 分支的类型是 7(int32),cls 分支是 1(float32)。


方案二:使用社区验证过的导出脚本

如果不想自己修改,可以直接使用社区已验证的 YOLOv8 导出脚本:

  1. 参考帖子:RDKX5 部署 yolov8 模型到 dnn_node_example 节点报错
  2. 下载并修改 export_monkey_patch.py,确保 bbox 输出有反量化
  3. 重新导出 → 量化 → 部署

方案三:检查 hb_mapper 配置(备选)

在你的 yaml 配置中,可以尝试添加量化相关参数,强制对输出进行量化:

model_parameters:
  onnx_model: './best.onnx'
  march: "bayes-e"
  layer_out_dump: False
  working_dir: 'model_output'
  output_model_file_prefix: 'yolov8_cow'
  # 添加以下参数
  output_quantize: True  # 尝试启用输出量化

input_parameters:
  input_name: "images"
  input_shape: ''
  input_type_rt: 'nv12'
  input_layout_rt: ''
  input_type_train: 'rgb'
  input_layout_train: 'NCHW'
  norm_type: 'data_scale'
  scale_value: 0.003921568627451

calibration_parameters:
  cal_data_dir: './cal_bin'
  cal_data_type: 'float32'
  calibration_type: 'default'

compiler_parameters:
  compile_mode: 'latency'
  debug: False
  optimize_level: 'O3'

注意:这个方案不一定有效,因为输出量化通常需要在 ONNX 层面处理。


快速验证

重新编译模型后,在板子上验证输出类型:

python3 << 'EOF'
from hobot_dnn import pyeasy_dnn as dnn
models = dnn.load('/home/sunrise/yolov8/cow.bin')
model = models[0]
print(f"Model outputs: {len(model.outputs)}")
for i, out in enumerate(model.outputs):
    p = out.properties
    print(f"Output[{i}]: shape={p.shape}, layout={p.layout}, type={p.dtype}")
EOF

期望输出(bbox 分支应该是 int32):

Output[0]: shape=(1, 80, 80, 5), layout=NHWC, type=int32    # bbox_P3
Output[1]: shape=(1, 80, 80, 64), layout=NHWC, type=float32 # cls_P3
Output[2]: shape=(1, 40, 40, 5), layout=NHWC, type=int32    # bbox_P4
Output[3]: shape=(1, 40, 40, 64), layout=NHWC, type=float32 # cls_P4
Output[4]: shape=(1, 20, 20, 5), layout=NHWC, type=int32    # bbox_P5
Output[5]: shape=(1, 20, 20, 64), layout=NHWC, type=float32 # cls_P5

相关资源


总结

  1. 问题根源:bbox 输出缺少反量化,导致类型不匹配
  2. 解决方法:修改 ONNX 导出脚本,对 bbox 分支添加反量化操作
  3. 验证方式:检查 bin 模型输出类型,确保 bbox 是 int32

建议优先采用方案一,直接修改导出脚本。如果遇到问题,可以把修改后的脚本发到社区,大家一起帮你调试!

你好!
我首先根据根据您提供的**Detect_forward** 函数,替换了,export_yolo26_detect_bpu.py中的函数如下

def bpu_detect_forward(self, x):
result = []
for i in range(self.nl):
# bbox 分支:添加反量化,将 float 转为 int32
bbox = self.cv2[i](x[i]) # (B, 4*reg_max, H, W)
# 关键:对 bbox 输出进行反量化
bbox = (bbox * 255.0).to(torch.int32) # 或者使用合适的 scale

    # cls 分支:保持 float32
    cls = self.cv3\[i\](x\[i\])  # (B, nc, H, W)

    # 注意输出顺序:先 bbox 后 cls
    result.append(bbox)
    result.append(cls)
return result

导出onnx文件,按照上文的yaml导出bin,

通过hrt_model_exec model_info --model_file=./cow2.bin查看后,


input[0]:
name: images
input source: HB_DNN_INPUT_FROM_PYRAMID
valid shape: (1,3,640,640,)
aligned shape: (1,3,640,640,)
aligned byte size: 614400
tensor type: HB_DNN_IMG_TYPE_NV12
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (0,0,0,0,)

output[0]:
name: output0
valid shape: (1,64,80,80,)
aligned shape: (1,64,80,80,)
aligned byte size: 1638400
tensor type: HB_DNN_TENSOR_TYPE_S32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (1638400,25600,320,4,)

output[1]:
name: 325
valid shape: (1,5,80,80,)
aligned shape: (1,5,80,80,)
aligned byte size: 128000
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (128000,25600,320,4,)

output[2]:
name: 335
valid shape: (1,64,40,40,)
aligned shape: (1,64,40,40,)
aligned byte size: 409600
tensor type: HB_DNN_TENSOR_TYPE_S32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (409600,6400,160,4,)

output[3]:
name: 342
valid shape: (1,5,40,40,)
aligned shape: (1,5,40,40,)
aligned byte size: 32000
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (32000,6400,160,4,)

output[4]:
name: 352
valid shape: (1,64,20,20,)
aligned shape: (1,64,20,20,)
aligned byte size: 102400
tensor type: HB_DNN_TENSOR_TYPE_S32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (102400,1600,80,4,)

output[5]:
name: 359
valid shape: (1,5,20,20,)
aligned shape: (1,5,20,20,)
aligned byte size: 8000
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (8000,1600,80,4,)

与官方提供的/opt/hobot/model/x5/basic/yolov8_640x640_nv12.bin比对后,
发现输出的是NHWC,不符合tros中NCHW的要求,并且,如果使用官方提供的bin文件运行,在日志中输出先是class再是bbox,报错如下:

root@ubuntu:/home/sunrise/yolov8# ros2 launch dnn_node_example dnn_node_example_feedback.launch.py dnn_example_config_file:=my_config/yolov8workconfig.json dnn_example_image:=my_config/target.jpg
[INFO] [launch]: All log files can be found below /root/.ros/log/2026-04-19-11-01-00-512309-ubuntu-18303
[INFO] [launch]: Default logging verbosity is set to INFO
dnn_node_example_path is /opt/tros/humble/lib/dnn_node_example
cp_cmd is cp -r /opt/tros/humble/lib/dnn_node_example/config .
[INFO] [example-1]: process started with pid [18313]
[example-1] [WARN] [1776567661.111449412] [dnn_example_node]: Parameter:
[example-1] feed_type(0:local, 1:sub): 0
[example-1] image: my_config/target.jpg
[example-1] image_type: 0
[example-1] dump_render_img: 1
[example-1] is_shared_mem_sub: 0
[example-1] config_file: my_config/yolov8workconfig.json
[example-1] msg_pub_topic_name: hobot_dnn_detection
[example-1] info_msg_pub_topic_name: hobot_dnn_detection_info
[example-1] ros_img_topic_name: /image
[example-1] sharedmem_img_topic_name: /hbmem_img
[example-1] [WARN] [1776567661.112213697] [dnn_example_node]: Load [5] class types from file [my_config/cow.list]
[example-1] [WARN] [1776567661.112328112] [dnn_example_node]: Parameter:
[example-1] model_file_name: /home/sunrise/yolov8/cow2.bin
[example-1] model_name:
[example-1] [INFO] [1776567661.112404445] [dnn]: Node init.
[example-1] [INFO] [1776567661.112428612] [dnn_example_node]: Set node para.
[example-1] [WARN] [1776567661.112468695] [dnn_example_node]: model_file_name_: /home/sunrise/yolov8/cow2.bin, task_num: 4
[example-1] [INFO] [1776567661.112514694] [dnn]: Model init.
[example-1] [BPU_PLAT]BPU Platform Version(1.3.6)! soc info(x5)
[example-1] [HBRT] set log level as 0. version = 3.15.55.0
[example-1] [DNN] Runtime version = 1.24.5_(3.15.55 HBRT)
[example-1] [A][DNN][packed_model.cpp:247]Model [HorizonRT] The model builder version = 1.24.3
[example-1] [INFO] [1776567661.316857044] [dnn]: The model input 0 width is 640 and height is 640
[example-1] [INFO] [1776567661.317027126] [dnn]:
[example-1] Model Info:
[example-1] name: yolov8_cow.
[example-1] [input]
[example-1] - (0) Layout: NCHW, Shape: [1, 3, 640, 640], Type: HB_DNN_IMG_TYPE_NV12.
[example-1] [output]
[example-1] - (0) Layout: NCHW, Shape: [1, 64, 80, 80], Type: HB_DNN_TENSOR_TYPE_S32.
[example-1] - (1) Layout: NCHW, Shape: [1, 5, 80, 80], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (2) Layout: NCHW, Shape: [1, 64, 40, 40], Type: HB_DNN_TENSOR_TYPE_S32.
[example-1] - (3) Layout: NCHW, Shape: [1, 5, 40, 40], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (4) Layout: NCHW, Shape: [1, 64, 20, 20], Type: HB_DNN_TENSOR_TYPE_S32.
[example-1] - (5) Layout: NCHW, Shape: [1, 5, 20, 20], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1]
[example-1] [INFO] [1776567661.317127500] [dnn]: Task init.
[example-1] [INFO] [1776567661.318836611] [dnn]: Set task_num [4]
[example-1] [WARN] [1776567661.318923027] [dnn_example_node]: Get model name: yolov8_cow from load model.
[example-1] [INFO] [1776567661.319047317] [dnn_example_node]: The model input width is 640 and height is 640
[example-1] [WARN] [1776567661.319111942] [dnn_example_node]: Create ai msg publisher with topic_name: hobot_dnn_detection
[example-1] [INFO] [1776567661.333122281] [dnn_example_node]: Dnn node feed with local image: my_config/target.jpg
[example-1] [INFO] [1776567661.397211154] [dnn_example_node]: Output from frame_id: feedback, stamp: 0.0
[ERROR] [example-1]: process has died [pid 18313, exit code -11, cmd ‘/opt/tros/humble/lib/dnn_node_example/example --ros-args --log-level info --ros-args --params-file /tmp/launch_params_8k9kj7ho --params-file /tmp/launch_params_u6o74r6w --params-file /tmp/launch_params_exm_6wt0 --params-file /tmp/launch_params_tjgz15zw --params-file /tmp/launch_params_e_feltt4’].

于是我返回export_yolo26_detect_bpu.py函数修改bpu_detect_forward函数如下

def bpu_detect_forward(self, x):
result = []
for i in range(self.nl):
# bbox 分支:添加反量化,将 float 转为 int32
bbox = self.cv2[i](x[i]) # (B, 4*reg_max, H, W)
# 关键:对 bbox 输出进行反量化
bbox = (bbox * 255.0).to(torch.int32) # 或者使用合适的 scale

    # cls 分支:保持 float32
    cls = self.cv3\[i\](x\[i\])  # (B, nc, H, W)

    
    bbox=bbox.permute(0, 2, 3, 1)
    cls=cls.permute(0, 2, 3, 1)
    result.append(cls)
    result.append(bbox)
return result

调换了cls和bbox的顺序,并且加上了permute,得到的bin模型如下:
input[0]:
name: images
input source: HB_DNN_INPUT_FROM_PYRAMID
valid shape: (1,3,640,640,)
aligned shape: (1,3,640,640,)
aligned byte size: 614400
tensor type: HB_DNN_IMG_TYPE_NV12
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (0,0,0,0,)

output[0]:
name: output0
valid shape: (1,80,80,5,)
aligned shape: (1,80,80,5,)
aligned byte size: 128000
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NHWC
quanti type: NONE
stride: (128000,1600,20,4,)

output[1]:
name: 326
valid shape: (1,80,80,64,)
aligned shape: (1,80,80,64,)
aligned byte size: 1638400
tensor type: HB_DNN_TENSOR_TYPE_S32
tensor layout: HB_DNN_LAYOUT_NONE
quanti type: NONE
stride: (1638400,20480,256,4,)

output[2]:
name: 346
valid shape: (1,40,40,5,)
aligned shape: (1,40,40,5,)
aligned byte size: 32000
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NHWC
quanti type: NONE
stride: (32000,800,20,4,)

output[3]:
name: 345
valid shape: (1,40,40,64,)
aligned shape: (1,40,40,64,)
aligned byte size: 409600
tensor type: HB_DNN_TENSOR_TYPE_S32
tensor layout: HB_DNN_LAYOUT_NONE
quanti type: NONE
stride: (409600,10240,256,4,)

output[4]:
name: 365
valid shape: (1,20,20,5,)
aligned shape: (1,20,20,5,)
aligned byte size: 8000
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NHWC
quanti type: NONE
stride: (8000,400,20,4,)

output[5]:
name: 364
valid shape: (1,20,20,64,)
aligned shape: (1,20,20,64,)
aligned byte size: 102400
tensor type: HB_DNN_TENSOR_TYPE_S32
tensor layout: HB_DNN_LAYOUT_NONE
quanti type: NONE
stride: (102400,5120,256,4,)

发现输出顺序和维度能够与官方对上,但是bbox缺少:quanti type: NONE
运行tros报错如下:

root@ubuntu:/home/sunrise/yolov8# ros2 launch dnn_node_example dnn_node_example_feedback.launch.py dnn_example_config_file:=my_config/yolov8workconfig.json dnn_example_image:=my_config/target.jpg
[INFO] [launch]: All log files can be found below /root/.ros/log/2026-04-19-11-07-11-378782-ubuntu-21792
[INFO] [launch]: Default logging verbosity is set to INFO
dnn_node_example_path is /opt/tros/humble/lib/dnn_node_example
cp_cmd is cp -r /opt/tros/humble/lib/dnn_node_example/config .
[INFO] [example-1]: process started with pid [21802]
[example-1] [WARN] [1776568031.976493367] [dnn_example_node]: Parameter:
[example-1] feed_type(0:local, 1:sub): 0
[example-1] image: my_config/target.jpg
[example-1] image_type: 0
[example-1] dump_render_img: 1
[example-1] is_shared_mem_sub: 0
[example-1] config_file: my_config/yolov8workconfig.json
[example-1] msg_pub_topic_name: hobot_dnn_detection
[example-1] info_msg_pub_topic_name: hobot_dnn_detection_info
[example-1] ros_img_topic_name: /image
[example-1] sharedmem_img_topic_name: /hbmem_img
[example-1] [WARN] [1776568031.977326956] [dnn_example_node]: Load [5] class types from file [my_config/cow.list]
[example-1] [WARN] [1776568031.977458874] [dnn_example_node]: Parameter:
[example-1] model_file_name: /home/sunrise/yolov8/cow.bin
[example-1] model_name:
[example-1] [INFO] [1776568031.977540000] [dnn]: Node init.
[example-1] [INFO] [1776568031.977564250] [dnn_example_node]: Set node para.
[example-1] [WARN] [1776568031.977604375] [dnn_example_node]: model_file_name_: /home/sunrise/yolov8/cow.bin, task_num: 4
[example-1] [INFO] [1776568031.977650292] [dnn]: Model init.
[example-1] [BPU_PLAT]BPU Platform Version(1.3.6)! soc info(x5)
[example-1] [HBRT] set log level as 0. version = 3.15.55.0
[example-1] [DNN] Runtime version = 1.24.5_(3.15.55 HBRT)
[example-1] [A][DNN][packed_model.cpp:247]Model [HorizonRT] The model builder version = 1.24.3
[example-1] [INFO] [1776568032.179266548] [dnn]: The model input 0 width is 640 and height is 640
[example-1] [INFO] [1776568032.179469299] [dnn]:
[example-1] Model Info:
[example-1] name: yolov8_cow.
[example-1] [input]
[example-1] - (0) Layout: NCHW, Shape: [1, 3, 640, 640], Type: HB_DNN_IMG_TYPE_NV12.
[example-1] [output]
[example-1] - (0) Layout: NHWC, Shape: [1, 80, 80, 5], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (1) Layout: NONE, Shape: [1, 80, 80, 64], Type: HB_DNN_TENSOR_TYPE_S32.
[example-1] - (2) Layout: NHWC, Shape: [1, 40, 40, 5], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (3) Layout: NONE, Shape: [1, 40, 40, 64], Type: HB_DNN_TENSOR_TYPE_S32.
[example-1] - (4) Layout: NHWC, Shape: [1, 20, 20, 5], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (5) Layout: NONE, Shape: [1, 20, 20, 64], Type: HB_DNN_TENSOR_TYPE_S32.
[example-1]
[example-1] [INFO] [1776568032.179523550] [dnn]: Task init.
[example-1] [INFO] [1776568032.181172311] [dnn]: Set task_num [4]
[example-1] [WARN] [1776568032.181253187] [dnn_example_node]: Get model name: yolov8_cow from load model.
[example-1] [INFO] [1776568032.181369604] [dnn_example_node]: The model input width is 640 and height is 640
[example-1] [WARN] [1776568032.181418938] [dnn_example_node]: Create ai msg publisher with topic_name: hobot_dnn_detection
[example-1] [INFO] [1776568032.193146646] [dnn_example_node]: Dnn node feed with local image: my_config/target.jpg
[example-1] [INFO] [1776568032.260414870] [dnn_example_node]: Output from frame_id: feedback, stamp: 0.0
[example-1] [ERROR] [1776568032.261119708] [yolo8_detection_parser]: get_tensor_hw failed
[example-1] [ERROR] [1776568032.261119833] [yolo8_detection_parser]: get_tensor_hw failed
[example-1] [ERROR] [1776568032.261256918] [yolo8_detection_parser]: get_tensor_hw failed
[example-1] [INFO] [1776568032.261404127] [PostProcessBase]: out box size: 0
[example-1] [INFO] [1776568032.261436502] [ClassificationPostProcess]: out cls size: 0
[example-1] [INFO] [1776568032.263866061] [ImageUtils]: target size: 0
[example-1] [WARN] [1776568032.263957145] [ImageUtils]: Draw result to file: render_feedback_0_0.jpeg

查询ai后怀疑有两种可能:

1是我在运行hb_mapper makertbin --model-type onnx --config yolov8.yaml中yaml文件没有设置量化导致bbox的quanti type为None,但是我尝试在yaml加上
optimization: ‘set_node_output_int32:326,345,364’
后,运行hb_mappr报错如下:
root@46a86a8809fe:/data# hb_mapper makertbin --model-type onnx --config yolov8.yaml
2026-04-19 11:27:52,418 INFO log will be stored in /data/hb_mapper_makertbin.log
2026-04-19 11:27:52,419 INFO Start hb_mapper…
2026-04-19 11:27:52,421 INFO hbdk version 3.49.15
2026-04-19 11:27:52,422 INFO horizon_nn version 1.1.0
2026-04-19 11:27:52,422 INFO hb_mapper version 1.24.3
2026-04-19 11:27:52,423 INFO Start Model Convert…
2026-04-19 11:27:52,433 INFO Using onnx model file: /data/best.onnx
2026-04-19 11:27:52,573 INFO Model has 1 inputs according to model file
2026-04-19 11:27:52,579 INFO Model input shape not given in yaml_file, using shape from model file: [[1, 3, 640, 640]]
2026-04-19 11:27:52,580 INFO nv12 input type rt received.
2026-04-19 11:27:52,585 WARNING The calibration dir name suffix is not the same as the value float32 of the parameter cal_data_type, the parameter setting will prevail
2026-04-19 11:27:52,588 INFO custom_op does not exist, skipped
2026-04-19 11:27:52,591 WARNING Input node images’s input_source not set, it will be set to pyramid by default
2026-04-19 11:27:52,609 INFO *******************************************
2026-04-19 11:27:52,610 INFO First calibration picture name: 000d64dae0250e8b.bin
2026-04-19 11:27:52,612 INFO First calibration picture md5:
056d797381f1224d368ed8c3fc8c71db /data/cal_bin/000d64dae0250e8b.bin
2026-04-19 11:27:52,714 INFO *******************************************
2026-04-19 11:27:55,081 INFO Start to Horizon NN Model Convert.
2026-04-19 11:27:55,250 INFO Loading horizon_nn debug methods:set()
2026-04-19 11:27:55,267 ERROR *** ERROR-OCCUR-DURING {horizon_nn.build_onnx} ***, error message: Unsupported datatype settings for march bayes: int32:326,345,364

是不是因为我的的OE版本为1.2.8,我想请问一下X5能支持的最新版本的OE为多少?

2, 是不是因为我在export_yolo26_detect_bpu.py的def bpu_detect_forward(self, x):
result = []
for i in range(self.nl):
# bbox 分支:添加反量化,将 float 转为 int32
bbox = self.cv2[i](x[i]) # (B, 4*reg_max, H, W)
# 关键:对 bbox 输出进行反量化
bbox = (bbox * 255.0).to(torch.int32) # 或者使用合适的 scale

    \# cls 分支:保持 float32
    cls = self.cv3\[i\](x\[i\])  # (B, nc, H, W)


    bbox=bbox.permute(0, 2, 3, 1)
    cls=cls.permute(0, 2, 3, 1)
    result.append(cls)
    result.append(bbox)
return result

修改导致提前把bbox变成了的int32导致后面模型bbox变成了None?

你好!你的问题定位非常精准,核心问题在于 YOLOv8 的 bbox 分支缺少正确的量化信息(quanti type),导致 TROS 的 parser 无法正确解析。

问题结论

你的猜测 2 是正确的:在 export_yolo26_detect_bpu.py 中提前将 bbox 转换为 int32,导致 hb_mapper 无法识别这是需要量化的浮点输出,最终 quanti type 显示为 NONE。

关键错误点:

  1. ONNX 导出时不应手动转 int32:量化应该在 hb_mapper 阶段完成,而不是在 PyTorch 导出时
  2. 输出顺序错误:TROS 的 YOLOv8 parser 期望 先 cls 后 bbox(与你当前代码相反)
  3. 缺少量化配置:yaml 中需要正确配置输出节点的量化策略

正确解决方案

步骤 1:修正 ONNX 导出脚本

关键修改:

  • 不要在 PyTorch 中手动转 int32
  • 保持 bbox 和 cls 都是 float32
  • 调整输出顺序为 先 cls 后 bbox(匹配官方模型)
  • 添加 permute 将 NCHW 转为 NHWC(BPU 要求)
def bpu_detect_forward(self, x):
    result = []
    for i in range(self.nl):
        # bbox 分支:保持 float32,不要转 int32!
        bbox = self.cv2[i](x[i])  # (B, 4*reg_max, H, W)
        
        # cls 分支:保持 float32
        cls = self.cv3[i](x[i])  # (B, nc, H, W)
        
        # 关键:先 permute 再调整顺序
        # 1. NCHW -> NHWC
        bbox = bbox.permute(0, 2, 3, 1).contiguous()  # (B, H, W, 4*reg_max)
        cls = cls.permute(0, 2, 3, 1).contiguous()    # (B, H, W, nc)
        
        # 2. 输出顺序:先 cls 后 bbox(匹配官方)
        result.append(cls)
        result.append(bbox)
    return result

重新导出 ONNX:

cd /path/to/export_script
python export_yolo26_detect_bpu.py --pt your_model.pt --imgsz 640 640 --opset 11

验证 ONNX 输出(应该全是 float32):

python3 -c "
import onnx
model = onnx.load('best.onnx')
for output in model.graph.output:
    elem_type = output.type.tensor_type.elem_type
    shape = [d.dim_value for d in output.type.tensor_type.shape.dim]
    type_name = 'float32' if elem_type == 1 else 'int32' if elem_type == 7 else f'unknown({elem_type})'
    print(f'{output.name}: shape={shape}, type={type_name}')
"

期望输出(全是 float32):

output0: shape=[1, 80, 80, 5], type=float32    # cls_P3
output1: shape=[1, 80, 80, 64], type=float32  # bbox_P3
output2: shape=[1, 40, 40, 5], type=float32   # cls_P4
output3: shape=[1, 40, 40, 64], type=float32  # bbox_P4
output4: shape=[1, 20, 20, 5], type=float32   # cls_P5
output5: shape=[1, 20, 20, 64], type=float32  # bbox_P5

步骤 2:修正 hb_mapper YAML 配置

关键修改:

  • 移除错误的 set_node_output_int32 配置(这个语法不支持)
  • 添加正确的量化策略配置
  • 确保校准数据充足(至少 100 张)
model_parameters:
  onnx_model: './best.onnx'
  march: "bayes-e"
  layer_out_dump: False
  working_dir: 'model_output'
  output_model_file_prefix: 'yolov8_cow'

input_parameters:
  input_name: "images"
  input_shape: '1x3x640x640'
  input_type_rt: 'nv12'
  input_layout_rt: 'NHWC'
  input_type_train: 'rgb'
  input_layout_train: 'NCHW'
  norm_type: 'data_scale'
  scale_value: 0.003921568627451

calibration_parameters:
  cal_data_dir: './cal_bin'
  cal_data_type: 'float32'
  calibration_type: 'default'  # 或 'max'
  # 关键:确保校准数据充足
  cal_data_count: 100

compiler_parameters:
  compile_mode: 'latency'
  debug: False
  optimize_level: 'O3'
  
# 关键:添加输出量化配置(如果 hb_mapper 版本支持)
optimization_parameters:
  # 不要手动指定 int32,让 hb_mapper 自动处理
  # 某些版本支持以下配置(尝试)
  quantize_output_nodes: True

重新编译模型:

hb_mapper makertbin --model-type onnx --config yolov8.yaml

步骤 3:验证 bin 模型输出

编译完成后,检查输出类型和 quanti type:

hrt_model_exec model_info --model_file=./yolov8_cow.bin

期望输出(注意 quanti type 应该有值):

output[0]:
  valid shape: (1,80,80,5,)
  tensor type: HB_DNN_TENSOR_TYPE_F32
  tensor layout: HB_DNN_LAYOUT_NHWC
  quanti type: SCALE  # 或 SHIFT,不应该是 NONE

output[1]:
  valid shape: (1,80,80,64,)
  tensor type: HB_DNN_TENSOR_TYPE_S32  # bbox 应该是 int32
  tensor layout: HB_DNN_LAYOUT_NHWC
  quanti type: SCALE  # 关键:这里有量化信息

如果 quanti type 仍然是 NONE,说明量化失败,可能是:

  1. 校准数据不足或质量差
  2. ONNX 模型结构有问题
  3. hb_mapper 版本不支持自动输出量化

步骤 4:检查 TROS 配置文件

确保 yolov8workconfig.json 配置正确:

{
  "model_file": "/home/sunrise/yolov8/yolov8_cow.bin",
  "task_num": 4,
  "dnn_parser": "yolov8",
  "model_output_count": 6,
  "reg_max": 16,
  "class_num": 5,
  "cls_names_list": "my_config/cow.list",
  "strides": [8, 16, 32],
  "score_threshold": 0.25,
  "nms_threshold": 0.7,
  "nms_top_k": 300,
  "output_order": [0, 1, 2, 3, 4, 5]
}

步骤 5:OE 版本问题

你提到的 OE 1.2.8 版本问题:

  • RDK X5 最新 OE 版本:截至 2024 年底,最新版本是 1.2.8(你当前使用的)
  • 建议:检查是否有更新版本,访问 地瓜开发者社区 下载中心
  • 版本兼容性:你的 hb_mapper 版本 1.24.3 与运行时 1.24.5 接近,一般没问题

快速排查清单

检查项 期望结果 当前状态
ONNX 输出类型 全是 float32 :cross_mark: 你改成了 int32
输出顺序 先 cls 后 bbox :cross_mark: 你是先 bbox 后 cls
输出布局 NHWC :white_check_mark: 已修正
bin 模型 quanti type SCALE/SHIFT :cross_mark: 显示 NONE
校准数据数量 ≥100 张 需确认

参考资源


总结

  1. 回退 ONNX 导出脚本:不要手动转 int32,保持 float32
  2. 调整输出顺序:先 cls 后 bbox
  3. 确保校准数据充足:至少 100 张代表性图片
  4. 让 hb_mapper 自动处理量化:不要手动指定 int32

按照上述步骤重新导出 → 量化 → 部署,应该能解决 quanti type: NONE 的问题!如果还有问题,可以把新的 hrt_model_exec model_info 输出发出来继续分析。

你好!我首先纠正一下我上文提到的错误,我的OE版本为1.24.3

root@46a86a8809fe:/data# hb_mapper --version
hb_mapper, version 1.24.3

成功导出onnx模型并查看

在编写yaml查看发现了版本不适配的error

yaml如下:model_parameters:
onnx_model: ‘./best.onnx’
march: “bayes-e”
layer_out_dump: False
working_dir: ‘model_output’
output_model_file_prefix: ‘yolov8_cow’

input_parameters:
input_name: “images”
input_shape: ‘1x3x640x640’
input_type_rt: ‘nv12’
input_layout_rt: ‘NHWC’
input_type_train: ‘rgb’
input_layout_train: ‘NCHW’
norm_type: ‘data_scale’
scale_value: 0.003921568627451

calibration_parameters:
cal_data_dir: ‘./cal_bin’
cal_data_type: ‘float32’
calibration_type: ‘default’
cal_data_count: 100

compiler_parameters:
compile_mode: ‘latency’
debug: False
optimize_level: ‘O3’

optimization_parameters:
quantize_output_nodes: True

error如下:

root@46a86a8809fe:/data# hb_mapper makertbin --model-type onnx --config yolov8.yaml
2026-04-19 11:53:47,300 INFO log will be stored in /data/hb_mapper_makertbin.log
2026-04-19 11:53:47,301 INFO Start hb_mapper…
2026-04-19 11:53:47,302 INFO hbdk version 3.49.15
2026-04-19 11:53:47,303 INFO horizon_nn version 1.1.0
2026-04-19 11:53:47,304 INFO hb_mapper version 1.24.3
2026-04-19 11:53:47,305 INFO Start Model Convert…
2026-04-19 11:53:47,316 ERROR yaml file parse failed. Please double check your config file inputs
2026-04-19 11:53:47,322 ERROR Key ‘calibration_parameters’ error:
Wrong key ‘cal_data_count’ in {‘cal_data_dir’: ‘./cal_bin’, ‘cal_data_type’: ‘float32’, ‘calibration_type’: ‘default’, ‘cal_data_count’: 100}

删掉最后yaml最后一段的尝试:

error如下:
root@46a86a8809fe:/data# hb_mapper makertbin --model-type onnx --config yolov8.yaml
2026-04-19 11:59:33,204 INFO log will be stored in /data/hb_mapper_makertbin.log
2026-04-19 11:59:33,205 INFO Start hb_mapper…
2026-04-19 11:59:33,206 INFO hbdk version 3.49.15
2026-04-19 11:59:33,207 INFO horizon_nn version 1.1.0
2026-04-19 11:59:33,208 INFO hb_mapper version 1.24.3
2026-04-19 11:59:33,208 INFO Start Model Convert…
2026-04-19 11:59:33,215 ERROR yaml file parse failed. Please double check your config file inputs
2026-04-19 11:59:33,330 ERROR Key ‘calibration_parameters’ error:
Wrong key ‘cal_data_count’ in {‘cal_data_dir’: ‘./cal_bin’, ‘cal_data_type’: ‘float32’, ‘calibration_type’: ‘default’, ‘cal_data_count’: 100}
是不是我的OE版本过低不适配?

你好!你的问题很明确:cal_data_count 不是 calibration_parameters 的有效配置项,这是配置参数名称错误导致的。

问题结论

cal_data_count 参数不存在,应该移除。校准数据数量由你放入 cal_data_dir 目录的实际文件数量决定,不需要在 YAML 中指定。


正确的 YAML 配置

根据你的 hb_mapper 版本 (1.24.3),修正后的配置如下:

model_parameters:
  onnx_model: './best.onnx'
  march: "bayes-e"
  layer_out_dump: False
  working_dir: 'model_output'
  output_model_file_prefix: 'yolov8_cow'

input_parameters:
  input_name: "images"
  input_type_rt: 'nv12'
  input_type_train: 'rgb'
  input_layout_train: 'NCHW'
  norm_type: 'data_scale'
  scale_value: 0.003921568627451

calibration_parameters:
  cal_data_dir: './cal_bin'
  cal_data_type: 'float32'
  calibration_type: 'default'
  # 删除 cal_data_count: 100  ← 这个参数不存在!

compiler_parameters:
  compile_mode: 'latency'
  debug: False
  optimize_level: 'O3'

# 删除 optimization_parameters 段落(你的版本不支持 quantize_output_nodes)

关键修改点

错误配置 正确做法
cal_data_count: 100 删除,不需要此参数
optimization_parameters: quantize_output_nodes: True 删除,1.24.3 版本不支持
input_layout_rt: 'NHWC' 删除,板端布局由 BPU 自动处理

校准数据准备

校准数据数量由目录中的实际文件数决定:

# 检查校准数据数量
ls ./cal_bin/*.bin | wc -l

# 如果少于 100 张,建议补充
# 校准数据应该是已经预处理成 bin 格式的图片

要求:

  • 至少 50-100 张 代表性图片
  • 格式为 .bin(已预处理为模型输入格式)
  • 覆盖各种场景(光照、角度、目标大小等)

执行步骤

步骤 1:修正 YAML 文件

cat > yolov8.yaml <<'EOF'
model_parameters:
  onnx_model: './best.onnx'
  march: "bayes-e"
  layer_out_dump: False
  working_dir: 'model_output'
  output_model_file_prefix: 'yolov8_cow'

input_parameters:
  input_name: "images"
  input_type_rt: 'nv12'
  input_type_train: 'rgb'
  input_layout_train: 'NCHW'
  norm_type: 'data_scale'
  scale_value: 0.003921568627451

calibration_parameters:
  cal_data_dir: './cal_bin'
  cal_data_type: 'float32'
  calibration_type: 'default'

compiler_parameters:
  compile_mode: 'latency'
  debug: False
  optimize_level: 'O3'
EOF

步骤 2:重新编译

hb_mapper makertbin --model-type onnx --config yolov8.yaml

步骤 3:验证输出

编译成功后,检查模型输出:

hrt_model_exec model_info --model_file=./model_output/yolov8_cow.bin

期望输出(bbox 应该有 quanti type):

output[0]:
  valid shape: (1,80,80,5,)
  tensor type: HB_DNN_TENSOR_TYPE_F32
  tensor layout: HB_DNN_LAYOUT_NHWC
  quanti type: SCALE  # 或 SHIFT

output[1]:
  valid shape: (1,80,80,64,)
  tensor type: HB_DNN_TENSOR_TYPE_S32  # bbox 应该是 int32
  tensor layout: HB_DNN_LAYOUT_NHWC
  quanti type: SCALE  # 关键:这里有量化信息

关于 OE 版本

你提到的版本信息:

  • hb_mapper version: 1.24.3 :white_check_mark:(这是工具链版本,不是 OE 版本)
  • OE 版本: 应该是 1.2.8(对应 hb_mapper 1.24.x)

版本兼容性:

  • 你的版本是最新的,不需要升级
  • 配置格式错误是因为参数名称不对,不是版本问题

如果 quanti type 仍然是 NONE

如果编译后 quanti type 还是显示 NONE,可能原因:

  1. 校准数据不足:确保 cal_bin 目录有足够图片
  2. ONNX 模型问题:确认导出脚本已修正(保持 float32,先 cls 后 bbox)
  3. 需要手动配置输出量化(高级):
    • 参考社区教程使用 QAT 方案
    • 或在 ONNX 中添加 FakeQuantize 节点

参考资源

先按上述配置重新编译,然后把 hrt_model_exec model_info 的输出发出来,我们继续分析!

你好!看到你已经修改了 YAML 配置,但消息似乎没发完整 :blush:

请补充以下信息,帮你继续排查:


需要确认的内容

1. 编译是否成功?

hb_mapper makertbin --model-type onnx --config yolov8.yaml
  • :white_check_mark: 成功:会生成 model_output/yolov8_cow.bin
  • :cross_mark: 失败:请把完整错误日志发出来

2. 模型输出信息

编译成功后,运行以下命令并贴出输出:

hrt_model_exec model_info --model_file=./model_output/yolov8_cow.bin

重点看:

  • tensor type:bbox 分支应该是 HB_DNN_TENSOR_TYPE_S32
  • quanti type:不应该是 NONE,应该是 SCALE 或 SHIFT
  • tensor layout:应该是 HB_DNN_LAYOUT_NHWC

3. 校准数据数量

确认校准数据是否充足:

ls ./cal_bin/*.bin | wc -l

建议至少 50-100 张 校准图片。


4. TROS 运行测试

如果模型信息正常,再测试板端运行:

ros2 launch dnn_node_example dnn_node_example_feedback.launch.py \
  dnn_example_config_file:=my_config/yolov8workconfig.json \
  dnn_example_image:=my_config/target.jpg

把运行日志(特别是 crash 前的最后几行)发出来。


快速排查清单

检查项 命令 期望结果
编译成功 hb_mapper makertbin 无 ERROR,生成.bin 文件
校准数据 ls ./cal_bin/*.bin | wc -l ≥50 张
bbox 类型 hrt_model_exec model_info S32 + quanti type ≠ NONE
输出顺序 同上 先 cls 后 bbox
输出布局 同上 NHWC

请把编译日志和模型信息输出贴出来,我们继续分析!如果还有报错,直接发完整错误信息即可 :rocket:

你好,根据您提供的正确的yaml我已修改如下:
model_parameters:
onnx_model: ‘./best.onnx’
march: “bayes-e”
layer_out_dump: False
working_dir: ‘model_output’
output_model_file_prefix: ‘yolov8_cow’

input_parameters:
input_name: “images”
input_type_rt: ‘nv12’
input_type_train: ‘rgb’
input_layout_train: ‘NCHW’
norm_type: ‘data_scale’
scale_value: 0.003921568627451

calibration_parameters:
cal_data_dir: ‘./cal_bin’
cal_data_type: ‘float32’
calibration_type: ‘default’

compiler_parameters:
compile_mode: ‘latency’
debug: False
optimize_level: ‘O3’
并且成功导出bin模型,模型如下:
root@ubuntu:/home/sunrise/yolov8# hrt_model_exec model_info --model_file=./cow5.bin
hrt_model_exec model_info --model_file=./cow5.bin
I0000 00:00:00.000000 54584 vlog_is_on.cc:197] RAW: Set VLOG level for “*” to 3
[BPU_PLAT]BPU Platform Version(1.3.6)! soc info(x5)
[HBRT] set log level as 0. version = 3.15.55.0
[DNN] Runtime version = 1.24.5_(3.15.55 HBRT)
[A][DNN][packed_model.cpp:247]Model [HorizonRT] The model builder version = 1.24.3
Load model to DDR cost 187.368ms.
This model file has 1 model:
[yolov8_cow]

input[0]:
name: images
input source: HB_DNN_INPUT_FROM_PYRAMID
valid shape: (1,3,640,640,)
aligned shape: (1,3,640,640,)
aligned byte size: 614400
tensor type: HB_DNN_IMG_TYPE_NV12
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (0,0,0,0,)

output[0]:
name: output0
valid shape: (1,80,80,5,)
aligned shape: (1,80,80,5,)
aligned byte size: 128000
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NHWC
quanti type: NONE
stride: (128000,1600,20,4,)

output[1]:
name: 326
valid shape: (1,80,80,64,)
aligned shape: (1,80,80,64,)
aligned byte size: 1638400
tensor type: HB_DNN_TENSOR_TYPE_S32
tensor layout: HB_DNN_LAYOUT_NONE
quanti type: NONE
stride: (1638400,20480,256,4,)

output[2]:
name: 346
valid shape: (1,40,40,5,)
aligned shape: (1,40,40,5,)
aligned byte size: 32000
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NHWC
quanti type: NONE
stride: (32000,800,20,4,)

output[3]:
name: 345
valid shape: (1,40,40,64,)
aligned shape: (1,40,40,64,)
aligned byte size: 409600
tensor type: HB_DNN_TENSOR_TYPE_S32
tensor layout: HB_DNN_LAYOUT_NONE
quanti type: NONE
stride: (409600,10240,256,4,)

output[4]:
name: 365
valid shape: (1,20,20,5,)
aligned shape: (1,20,20,5,)
aligned byte size: 8000
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NHWC
quanti type: NONE
stride: (8000,400,20,4,)

output[5]:
name: 364
valid shape: (1,20,20,64,)
aligned shape: (1,20,20,64,)
aligned byte size: 102400
tensor type: HB_DNN_TENSOR_TYPE_S32
tensor layout: HB_DNN_LAYOUT_NONE
quanti type: NONE
stride: (102400,5120,256,4,)

还是缺少quanti type ,我已经检查过我bin模型的数量

root@46a86a8809fe:/data# ls ./cal_bin/*bin | wc -l
117

我也再次看了一遍我的onnx模型的输出

E:\Anaconda\envs\yolov8_bin\python.exe E:\py_programs\yolov8_bin\temp.py
output0: shape=[1, 80, 80, 5], type=float32
323: shape=[1, 80, 80, 64], type=float32
340: shape=[1, 40, 40, 5], type=float32
339: shape=[1, 40, 40, 64], type=float32
356: shape=[1, 20, 20, 5], type=float32
355: shape=[1, 20, 20, 64], type=float32

运行tros报错如下:root@ubuntu:/home/sunrise/yolov8# ros2 launch dnn_node_example dnn_node_example_feedback.launch.py dnn_example_config_file:=my_config/yolov8workconfig.json dnn_example_image:=my_config/target.jpg
[INFO] [launch]: All log files can be found below /root/.ros/log/2026-04-19-12-07-44-533716-ubuntu-54771
[INFO] [launch]: Default logging verbosity is set to INFO
dnn_node_example_path is /opt/tros/humble/lib/dnn_node_example
cp_cmd is cp -r /opt/tros/humble/lib/dnn_node_example/config .
[INFO] [example-1]: process started with pid [54781]
[example-1] [WARN] [1776571665.132848355] [dnn_example_node]: Parameter:
[example-1] feed_type(0:local, 1:sub): 0
[example-1] image: my_config/target.jpg
[example-1] image_type: 0
[example-1] dump_render_img: 1
[example-1] is_shared_mem_sub: 0
[example-1] config_file: my_config/yolov8workconfig.json
[example-1] msg_pub_topic_name: hobot_dnn_detection
[example-1] info_msg_pub_topic_name: hobot_dnn_detection_info
[example-1] ros_img_topic_name: /image
[example-1] sharedmem_img_topic_name: /hbmem_img
[example-1] [WARN] [1776571665.133460525] [dnn_example_node]: Load [5] class types from file [my_config/cow.list]
[example-1] [WARN] [1776571665.133583943] [dnn_example_node]: Parameter:
[example-1] model_file_name: /home/sunrise/yolov8/cow5.bin
[example-1] model_name:
[example-1] [INFO] [1776571665.133664776] [dnn]: Node init.
[example-1] [INFO] [1776571665.133689151] [dnn_example_node]: Set node para.
[example-1] [WARN] [1776571665.133728985] [dnn_example_node]: model_file_name_: /home/sunrise/yolov8/cow5.bin, task_num: 4
[example-1] [INFO] [1776571665.133775610] [dnn]: Model init.
[example-1] [BPU_PLAT]BPU Platform Version(1.3.6)! soc info(x5)
[example-1] [HBRT] set log level as 0. version = 3.15.55.0
[example-1] [DNN] Runtime version = 1.24.5_(3.15.55 HBRT)
[example-1] [A][DNN][packed_model.cpp:247]Model [HorizonRT] The model builder version = 1.24.3
[example-1] [INFO] [1776571665.301035211] [dnn]: The model input 0 width is 640 and height is 640
[example-1] [INFO] [1776571665.301220087] [dnn]:
[example-1] Model Info:
[example-1] name: yolov8_cow.
[example-1] [input]
[example-1] - (0) Layout: NCHW, Shape: [1, 3, 640, 640], Type: HB_DNN_IMG_TYPE_NV12.
[example-1] [output]
[example-1] - (0) Layout: NHWC, Shape: [1, 80, 80, 5], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (1) Layout: NONE, Shape: [1, 80, 80, 64], Type: HB_DNN_TENSOR_TYPE_S32.
[example-1] - (2) Layout: NHWC, Shape: [1, 40, 40, 5], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (3) Layout: NONE, Shape: [1, 40, 40, 64], Type: HB_DNN_TENSOR_TYPE_S32.
[example-1] - (4) Layout: NHWC, Shape: [1, 20, 20, 5], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (5) Layout: NONE, Shape: [1, 20, 20, 64], Type: HB_DNN_TENSOR_TYPE_S32.
[example-1]
[example-1] [INFO] [1776571665.301274462] [dnn]: Task init.
[example-1] [INFO] [1776571665.302952055] [dnn]: Set task_num [4]
[example-1] [WARN] [1776571665.303037555] [dnn_example_node]: Get model name: yolov8_cow from load model.
[example-1] [INFO] [1776571665.303159097] [dnn_example_node]: The model input width is 640 and height is 640
[example-1] [WARN] [1776571665.303210514] [dnn_example_node]: Create ai msg publisher with topic_name: hobot_dnn_detection
[example-1] [INFO] [1776571665.315327079] [dnn_example_node]: Dnn node feed with local image: my_config/target.jpg
[example-1] [INFO] [1776571665.384210197] [dnn_example_node]: Output from frame_id: feedback, stamp: 0.0
[example-1] [ERROR] [1776571665.384396239] [dnn_example_node]: Inlvaid parser: 0
^C[WARNING] [launch]: user interrupted with ctrl-c (SIGINT)
[example-1] [INFO] [1776571934.067446662] [rclcpp]: signal_handler(signum=2)
我暂时想不到哪里出了问题了,请指教!!感谢!!!

你好!问题已经非常清晰了。核心问题有两个:

  1. quanti type: NONE:这是因为 hb_mapper 默认不会对已经是 int32 的输出进行二次量化标记。你在 ONNX 导出时虽然保持了 float32,但 hb_mapper 在某些版本或配置下,对于特定形状的输出(特别是 bbox 这种回归分支)如果没有明确的量化提示,可能会直接透传为 int32 但不标记量化参数。
  2. Invalid parser: 0:这是最关键的报错。说明 TROS 的 yolov8 解析器在初始化时失败了。结合你的模型输出(bbox 分支 layout: NONE 而不是 NHWC),解析器无法正确识别张量布局,导致初始化失败。

根本原因:你的 bbox 分支输出布局显示为 NONE,而 TROS 的 YOLOv8 parser 期望所有输出都是 NHWC。这通常是因为 hb_mapper 在量化过程中,对于 int32 输出没有正确继承或设置布局信息。


解决方案

方案一:强制 hb_mapper 对输出进行量化(推荐尝试)

虽然 optimization_parameters 在你的版本中不支持,但我们可以尝试在 compiler_parameters 中添加调试选项,或者检查是否有其他配置方式。

修改 YAML:

model_parameters:
  onnx_model: './best.onnx'
  march: "bayes-e"
  layer_out_dump: True  # 开启层输出 dump,用于调试
  working_dir: 'model_output'
  output_model_file_prefix: 'yolov8_cow'

input_parameters:
  input_name: "images"
  input_type_rt: 'nv12'
  input_type_train: 'rgb'
  input_layout_train: 'NCHW'
  norm_type: 'data_scale'
  scale_value: 0.003921568627451

calibration_parameters:
  cal_data_dir: './cal_bin'
  cal_data_type: 'float32'
  calibration_type: 'default'

compiler_parameters:
  compile_mode: 'latency'
  debug: True  # 开启调试模式
  optimize_level: 'O3'

重新编译后,检查 model_output 目录下的日志文件,看是否有关于输出量化的警告或错误。

方案二:检查 ONNX 导出脚本的 contiguous()

确保在 permute 之后调用了 .contiguous(),这有时会影响布局信息的传递:

def bpu_detect_forward(self, x):
    result = []
    for i in range(self.nl):
        bbox = self.cv2[i](x[i])
        cls = self.cv3[i](x[i])
        
        # 确保 permute 后是 contiguous 的
        bbox = bbox.permute(0, 2, 3, 1).contiguous()
        cls = cls.permute(0, 2, 3, 1).contiguous()
        
        result.append(cls)
        result.append(bbox)
    return result

重新导出 ONNX,然后重新量化。

方案三:使用官方推荐的 YOLOv8 导出脚本

如果上述方法都无效,建议直接使用社区验证过的导出脚本。参考 RDKX5 部署 yolov8 模型到 dnn_node_example 节点报错 帖子中的 export_monkey_patch.py。


关于 Invalid parser: 0

这个错误通常意味着 parser 初始化失败。可能的原因:

  1. 输出布局不匹配:parser 期望 NHWC,但模型输出是 NONE。
  2. 输出类型不匹配:parser 期望 bbox 是 S32 且有量化信息,但模型输出是 S32 却无量化信息。
  3. 配置文件错误:yolov8workconfig.json 中的 output_order 或其他参数配置错误。

检查 yolov8workconfig.json:

{
  "model_file": "/home/sunrise/yolov8/cow5.bin",
  "task_num": 4,
  "dnn_parser": "yolov8",
  "model_output_count": 6,
  "reg_max": 16,
  "class_num": 5,
  "cls_names_list": "my_config/cow.list",
  "strides": [8, 16, 32],
  "score_threshold": 0.25,
  "nms_threshold": 0.7,
  "nms_top_k": 300,
  "output_order": [0, 1, 2, 3, 4, 5]
}

确保 output_order 与模型输出顺序一致(先 cls 后 bbox)。


快速验证步骤

  1. 重新导出 ONNX:确保使用修正后的脚本(带 .contiguous())。
  2. 重新量化:使用修正后的 YAML(开启 debug: True)。
  3. 检查模型信息:
    hrt_model_exec model_info --model_file=./model_output/yolov8_cow.bin
    
    重点看 bbox 分支的 layout 是否为 NHWC,quanti type 是否有值。
  4. 运行 TROS:如果模型信息正常,再运行 TROS 测试。

如果问题依旧,请把 hb_mapper 的完整日志(/data/hb_mapper_makertbin.log)和 hrt_model_exec model_info 的完整输出发出来,我们继续深入分析!

你好!我首先尝试了方案一:得到的hb_mapper日志如下:

root@46a86a8809fe:/data# hb_mapper makertbin --model-type onnx --config yolov8.yaml

2026-04-19 13:31:31,013 INFO log will be stored in /data/hb_mapper_makertbin.log
2026-04-19 13:31:31,015 INFO Start hb_mapper…
2026-04-19 13:31:31,016 INFO hbdk version 3.49.15
2026-04-19 13:31:31,016 INFO horizon_nn version 1.1.0
2026-04-19 13:31:31,017 INFO hb_mapper version 1.24.3
2026-04-19 13:31:31,018 INFO Start Model Convert…
2026-04-19 13:31:31,024 INFO Using onnx model file: /data/best.onnx
2026-04-19 13:31:31,088 INFO Model has 1 inputs according to model file
2026-04-19 13:31:31,092 INFO Model input shape not given in yaml_file, using shape from model file: [[1, 3, 640, 640]]
2026-04-19 13:31:31,093 INFO nv12 input type rt received.
2026-04-19 13:31:31,096 WARNING The calibration dir name suffix is not the same as the value float32 of the parameter cal_data_type, the parameter setting will prevail
2026-04-19 13:31:31,097 INFO custom_op does not exist, skipped
2026-04-19 13:31:31,099 WARNING Input node images’s input_source not set, it will be set to pyramid by default
2026-04-19 13:31:31,109 INFO *******************************************
2026-04-19 13:31:31,110 INFO First calibration picture name: 000d64dae0250e8b.bin
2026-04-19 13:31:31,111 INFO First calibration picture md5:
056d797381f1224d368ed8c3fc8c71db /data/cal_bin/000d64dae0250e8b.bin
2026-04-19 13:31:31,183 INFO *******************************************
2026-04-19 13:31:40,645 INFO Start to Horizon NN Model Convert.
2026-04-19 13:31:40,775 INFO Loading horizon_nn debug methods:{‘dump_all_layers_output’, ‘dump_all_models’, ‘check_model_output_consistency’}
2026-04-19 13:31:40,777 INFO The activation calibration parameters:
calibration_type: [‘max’, ‘kl’]
max_percentile: [0.99995, 1.0]
per_channel: [True, False]
asymmetric: [True, False]
The modelwise search parameters:
similarity: 0.995
metric: cosine-similarity
2026-04-19 13:31:40,778 INFO input images is from pyramid. Its layout is set to NHWC
2026-04-19 13:31:40,780 INFO The specified model compilation architecture: bayes-e.
2026-04-19 13:31:40,781 INFO The specified model compilation optimization parameters: .
2026-04-19 13:31:40,784 INFO Start to prepare the onnx model.
2026-04-19 13:31:40,797 INFO Input ONNX Model Information:
ONNX IR version: 6
Opset version: [‘ai.onnx v11’, ‘horizon v1’]
Producer: pytorch v2.10.0
Domain: None
Version: None
Graph input:
images: shape=[1, 3, 640, 640], dtype=FLOAT32
Graph output:
output0: shape=[1, 80, 80, 5], dtype=FLOAT32
326: shape=[1, 80, 80, 64], dtype=INT32
346: shape=[1, 40, 40, 5], dtype=FLOAT32
345: shape=[1, 40, 40, 64], dtype=INT32
365: shape=[1, 20, 20, 5], dtype=FLOAT32
364: shape=[1, 20, 20, 64], dtype=INT32
2026-04-19 13:31:41,013 INFO End to prepare the onnx model.
2026-04-19 13:31:41,129 INFO Saving model to: yolov8_cow_original_float_model.onnx.
2026-04-19 13:31:41,131 INFO Start to optimize the onnx model.
2026-04-19 13:31:41,482 INFO End to optimize the onnx model.
2026-04-19 13:31:41,634 INFO Saving model to: yolov8_cow_optimized_float_model.onnx.
2026-04-19 13:31:41,636 INFO Start to calibrate the model.
2026-04-19 13:31:41,720 INFO There are 117 samples in the data set.
2026-04-19 13:31:41,721 INFO Run calibration model with modelwise search method.
2026-04-19 13:31:41,877 INFO Calibration using batch 8
calibration in progress: 100%|██████████████████████████████████████████████████████████| 15/15 [00:57<00:00, 3.84s/it]
2026-04-19 13:32:41,849 INFO Calibration using batch 8
calibration in progress: 100%|██████████████████████████████████████████████████████████| 15/15 [00:11<00:00, 1.33it/s]
2026-04-19 13:32:53,509 INFO Calibration using batch 8
calibration in progress: 100%|██████████████████████████████████████████████████████████| 15/15 [00:57<00:00, 3.84s/it]
2026-04-19 13:33:59,201 INFO Select max method.
2026-04-19 13:33:59,657 INFO End to calibrate the model.
2026-04-19 13:33:59,786 INFO Saving model to: yolov8_cow_calibrated_model.onnx.
2026-04-19 13:33:59,786 INFO Start to quantize the model.
2026-04-19 13:34:00,793 INFO End to quantize the model.
2026-04-19 13:34:00,859 INFO Saving model to: yolov8_cow_quantized_model.onnx.
2026-04-19 13:34:00,861 INFO Start to compile the model with march bayes-e.
2026-04-19 13:34:01,080 INFO Compile submodel: main_graph_subgraph_0
2026-04-19 13:34:01,096 INFO hbdk-cc parameters:[‘–O3’, ‘–debug’, ‘–core-num’, ‘1’, ‘–fast’, ‘–input-layout’, ‘NHWC’, ‘–output-layout’, ‘NHWC’, ‘–input-source’, ‘pyramid’]
[==================================================] 100%
2026-04-19 13:34:46,377 INFO consumed time 45.2478
2026-04-19 13:34:46,408 INFO hbir_model has been saved as : main_graph_subgraph_0.hbir
2026-04-19 13:34:46,494 INFO FPS=182.58, latency = 5477.2 us, DDR = 30787392 bytes (see main_graph_subgraph_0.html)
2026-04-19 13:34:46,499 INFO Compile submodel: main_graph_subgraph_1
2026-04-19 13:34:46,503 INFO hbdk-cc parameters:[‘–O3’, ‘–debug’, ‘–core-num’, ‘1’, ‘–fast’, ‘–input-layout’, ‘NHWC’, ‘–output-layout’, ‘NHWC’, ‘–input-source’, ‘ddr’]
2026-04-19 13:34:46,503 WARNING Can not find the scale for node /model.22/Cast
2026-04-19 13:34:46,553 INFO consumed time 0.034238
2026-04-19 13:34:46,558 INFO hbir_model has been saved as : main_graph_subgraph_1.hbir
2026-04-19 13:34:46,597 INFO FPS=3008.21, latency = 332.4 us, DDR = 3276800 bytes (see main_graph_subgraph_1.html)
2026-04-19 13:34:46,597 INFO Compile submodel: main_graph_subgraph_2
2026-04-19 13:34:46,601 INFO hbdk-cc parameters:[‘–O3’, ‘–debug’, ‘–core-num’, ‘1’, ‘–fast’, ‘–input-layout’, ‘NHWC’, ‘–output-layout’, ‘NHWC’, ‘–input-source’, ‘ddr’]
2026-04-19 13:34:46,601 WARNING Can not find the scale for node /model.22/Cast_1
2026-04-19 13:34:46,631 INFO consumed time 0.0146649
2026-04-19 13:34:46,634 INFO hbir_model has been saved as : main_graph_subgraph_2.hbir
2026-04-19 13:34:46,672 INFO FPS=8540.29, latency = 117.1 us, DDR = 819200 bytes (see main_graph_subgraph_2.html)
2026-04-19 13:34:46,673 INFO Compile submodel: main_graph_subgraph_3
2026-04-19 13:34:46,677 INFO hbdk-cc parameters:[‘–O3’, ‘–debug’, ‘–core-num’, ‘1’, ‘–fast’, ‘–input-layout’, ‘NHWC’, ‘–output-layout’, ‘NHWC’, ‘–input-source’, ‘ddr’]
2026-04-19 13:34:46,677 WARNING Can not find the scale for node /model.22/Cast_2
2026-04-19 13:34:46,707 INFO consumed time 0.0135146
2026-04-19 13:34:46,711 INFO hbir_model has been saved as : main_graph_subgraph_3.hbir
2026-04-19 13:34:46,750 INFO FPS=19759.72, latency = 50.6 us, DDR = 266240 bytes (see main_graph_subgraph_3.html)
2026-04-19 13:34:47,657 INFO core[0] open!
2026-04-19 13:34:49,564 INFO The consistency check between the quantized model and the hybrid model is passed.
2026-04-19 13:34:49,576 INFO End to compile the model with march bayes-e.
2026-04-19 13:34:49,607 INFO Saving model to: yolov8_cow_hybrid_model.onnx.
2026-04-19 13:34:50,795 INFO The main quantized node information:

Node ON Subgraph Type Cosine Similarity Threshold DataType

HZ_PREPROCESS_FOR_images BPU id(0) HzSQuantizedPreprocess 1.000001 127.0 int8

/model.0/conv/Conv BPU id(0) HzSQuantizedConv 0.999674 1.46338 int8
/model.0/act/Mul BPU id(0) HzLut 0.997263 74.0371 int8
/model.1/conv/Conv BPU id(0) HzSQuantizedConv 0.995303 74.0371 int8
/model.1/act/Mul BPU id(0) HzLut 0.994129 184.717 int8
/model.2/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.991629 179.701 int8
/model.2/cv1/act/Mul BPU id(0) HzLut 0.983321 124.001 int8
/model.2/Split BPU id(0) Split 0.983015 42.7774 int8
/model.2/m.0/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.973426 42.7774 int8
/model.2/m.0/cv1/act/Mul BPU id(0) HzLut 0.970482 46.3572 int8
/model.2/m.0/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.957869 37.6097 int8
/model.2/m.0/cv2/act/Mul BPU id(0) HzLut 0.970077 48.973 int8
/model.2/m.0/Add BPU id(0) HzSElementwiseAdd 0.979875 42.7774 int8
/model.2/Concat BPU id(0) Concat 0.980861 42.7774 int8
/model.2/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.981447 42.7774 int8
/model.2/cv2/act/Mul BPU id(0) HzLut 0.976776 32.0627 int8
/model.3/conv/Conv BPU id(0) HzSQuantizedConv 0.979115 18.1482 int8
/model.3/act/Mul BPU id(0) HzLut 0.986760 12.0651 int8
/model.4/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.974193 9.33272 int8
/model.4/cv1/act/Mul BPU id(0) HzLut 0.974797 17.2818 int8
/model.4/Split BPU id(0) Split 0.960659 11.9049 int8
/model.4/m.0/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.980702 11.9049 int8
/model.4/m.0/cv1/act/Mul BPU id(0) HzLut 0.973264 8.53135 int8
/model.4/m.0/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.977899 6.29573 int8
/model.4/m.0/cv2/act/Mul BPU id(0) HzLut 0.979001 9.98503 int8
/model.4/m.0/Add BPU id(0) HzSElementwiseAdd 0.987550 11.9049 int8
/model.4/m.1/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.986461 7.68458 int8
/model.4/m.1/cv1/act/Mul BPU id(0) HzLut 0.972137 8.23987 int8
/model.4/m.1/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.979726 5.26921 int8
/model.4/m.1/cv2/act/Mul BPU id(0) HzLut 0.981552 15.0583 int8
/model.4/m.1/Add BPU id(0) HzSElementwiseAdd 0.989101 7.68458 int8
/model.4/Split_output_0_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.4/Split_output_1_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.4/m.0/Add_output_0_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.4/Concat BPU id(0) Concat 0.985911 11.9049 int8
/model.4/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.975511 12.7545 int8
/model.4/cv2/act/Mul BPU id(0) HzLut 0.971084 10.8896 int8
/model.5/conv/Conv BPU id(0) HzSQuantizedConv 0.984018 10.8894 int8
/model.5/act/Mul BPU id(0) HzLut 0.977714 9.20448 int8
/model.6/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.973792 7.33795 int8
/model.6/cv1/act/Mul BPU id(0) HzLut 0.965576 21.3122 int8
/model.6/Split BPU id(0) Split 0.956651 10.2489 int8
/model.6/m.0/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.989715 10.2489 int8
/model.6/m.0/cv1/act/Mul BPU id(0) HzLut 0.971021 10.462 int8
/model.6/m.0/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.986468 10.054 int8
/model.6/m.0/cv2/act/Mul BPU id(0) HzLut 0.976406 12.2858 int8
/model.6/m.0/Add BPU id(0) HzSElementwiseAdd 0.982137 10.2489 int8
/model.6/m.1/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.991775 9.07757 int8
/model.6/m.1/cv1/act/Mul BPU id(0) HzLut 0.979372 9.71347 int8
/model.6/m.1/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.983244 7.16838 int8
/model.6/m.1/cv2/act/Mul BPU id(0) HzLut 0.982953 15.2013 int8
/model.6/m.1/Add BPU id(0) HzSElementwiseAdd 0.985318 9.07757 int8
/model.6/Split_output_0_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.6/Split_output_1_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.6/m.0/Add_output_0_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.6/Concat BPU id(0) Concat 0.979011 10.2489 int8
/model.6/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.983604 14.8859 int8
/model.6/cv2/act/Mul BPU id(0) HzLut 0.966340 10.1515 int8
/model.7/conv/Conv BPU id(0) HzSQuantizedConv 0.984126 9.31075 int8
/model.7/act/Mul BPU id(0) HzLut 0.958860 13.8852 int8
/model.8/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.976055 8.58802 int8
/model.8/cv1/act/Mul BPU id(0) HzLut 0.953157 13.0038 int8
/model.8/Split BPU id(0) Split 0.948901 13.0038 int8
/model.8/m.0/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.983855 13.0038 int8
/model.8/m.0/cv1/act/Mul BPU id(0) HzLut 0.965304 11.9996 int8
/model.8/m.0/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.972421 10.0163 int8
/model.8/m.0/cv2/act/Mul BPU id(0) HzLut 0.963525 15.9143 int8
/model.8/m.0/Add BPU id(0) HzSElementwiseAdd 0.961504 13.0038 int8
/model.8/Split_output_0_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.8/Split_output_1_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.8/Concat BPU id(0) Concat 0.958261 13.0038 int8
/model.8/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.976409 15.9715 int8
/model.8/cv2/act/Mul BPU id(0) HzLut 0.952258 12.8862 int8
/model.9/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.987272 10.0171 int8
/model.9/m/MaxPool BPU id(0) HzQuantizedMaxPool 0.995478 9.50632 int8
/model.9/m_1/MaxPool BPU id(0) HzQuantizedMaxPool 0.996476 9.50632 int8
/model.9/m_2/MaxPool BPU id(0) HzQuantizedMaxPool 0.996879 9.50632 int8
/model.9/Concat BPU id(0) Concat 0.995637 9.50632 int8
/model.9/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.988740 9.50632 int8
/model.9/cv2/act/Mul BPU id(0) HzLut 0.960292 10.4385 int8
/model.10/Resize BPU id(0) HzQuantizedResizeUpsample 0.960340 12.6904 int8
/model.10/Resize_output_0_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.11/Concat BPU id(0) Concat 0.962788 12.6904 int8
/model.12/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.975019 9.31075 int8
/model.12/cv1/act/Mul BPU id(0) HzLut 0.965725 12.0623 int8
/model.12/Split BPU id(0) Split 0.952558 9.03751 int8
/model.12/m.0/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.982063 9.03751 int8
/model.12/m.0/cv1/act/Mul BPU id(0) HzLut 0.952635 10.5034 int8
/model.12/m.0/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.968507 6.65441 int8
/model.12/m.0/cv2/act/Mul BPU id(0) HzLut 0.961679 11.0998 int8
/model.12/Split_output_0_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.12/Split_output_1_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.12/Concat BPU id(0) Concat 0.964241 9.03751 int8
/model.12/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.973580 9.11435 int8
/model.12/cv2/act/Mul BPU id(0) HzLut 0.957963 12.5943 int8
/model.13/Resize BPU id(0) HzQuantizedResizeUpsample 0.957974 12.3839 int8
/model.13/Resize_output_0_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.14/Concat BPU id(0) Concat 0.963679 12.3839 int8
/model.15/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.983005 10.8894 int8
/model.15/cv1/act/Mul BPU id(0) HzLut 0.984530 11.2197 int8
/model.15/Split BPU id(0) Split 0.972859 6.38241 int8
/model.15/m.0/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.981540 6.38241 int8
/model.15/m.0/cv1/act/Mul BPU id(0) HzLut 0.975701 7.1668 int8
/model.15/m.0/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.974813 4.85655 int8
/model.15/m.0/cv2/act/Mul BPU id(0) HzLut 0.983766 9.08705 int8
/model.15/Split_output_0_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.15/Split_output_1_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.15/Concat BPU id(0) Concat 0.983901 6.38241 int8
/model.15/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.981353 8.46767 int8
/model.15/cv2/act/Mul BPU id(0) HzLut 0.981282 10.6199 int8
/model.16/conv/Conv BPU id(0) HzSQuantizedConv 0.972600 7.91471 int8
/model.22/cv2.0/cv2.0.0/conv/Conv BPU id(0) HzSQuantizedConv 0.972582 7.91471 int8
/model.22/cv3.0/cv3.0.0/conv/Conv BPU id(0) HzSQuantizedConv 0.953848 7.91471 int8
/model.16/act/Mul BPU id(0) HzLut 0.956925 12.384 int8
/model.22/cv2.0/cv2.0.0/act/Mul BPU id(0) HzLut 0.961294 22.516 int8
/model.22/cv3.0/cv3.0.0/act/Mul BPU id(0) HzLut 0.948441 13.076 int8
/model.17/Concat BPU id(0) Concat 0.957471 12.3839 int8
/model.22/cv2.0/cv2.0.1/conv/Conv BPU id(0) HzSQuantizedConv 0.965566 9.34952 int8
/model.22/cv3.0/cv3.0.1/conv/Conv BPU id(0) HzSQuantizedConv 0.963664 12.5227 int8
/model.18/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.966772 12.3839 int8
/model.22/cv2.0/cv2.0.1/act/Mul BPU id(0) HzLut 0.967149 33.1776 int8
/model.22/cv3.0/cv3.0.1/act/Mul BPU id(0) HzLut 0.965585 19.361 int8
/model.18/cv1/act/Mul BPU id(0) HzLut 0.953098 14.2131 int8
/model.22/cv2.0/cv2.0.2/Conv BPU id(0) HzSQuantizedConv 0.977380 33.1776 int8
/model.22/cv3.0/cv3.0.2/Conv BPU id(0) HzSQuantizedConv 0.998729 19.361 int8
/model.18/Split BPU id(0) Split 0.926620 14.2131 int8
/model.22/Transpose_1 CPU – Transpose 0.998729 – float
/model.18/m.0/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.977141 14.2131 int8
/model.22/Cast CPU – Cast 0.977370 – float
/model.22/Transpose BPU id(1) Transpose 0.977369 – int32
/model.18/m.0/cv1/act/Mul BPU id(0) HzLut 0.966430 11.0031 int8
/model.18/m.0/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.954741 7.55766 int8
/model.18/m.0/cv2/act/Mul BPU id(0) HzLut 0.949566 19.8326 int8
/model.18/Split_output_0_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.18/Split_output_1_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.18/Concat BPU id(0) Concat 0.949993 14.2131 int8
/model.18/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.972021 18.5159 int8
/model.18/cv2/act/Mul BPU id(0) HzLut 0.963390 20.3507 int8
/model.19/conv/Conv BPU id(0) HzSQuantizedConv 0.973306 10.2102 int8
/model.22/cv2.1/cv2.1.0/conv/Conv BPU id(0) HzSQuantizedConv 0.967496 10.2102 int8
/model.22/cv3.1/cv3.1.0/conv/Conv BPU id(0) HzSQuantizedConv 0.951763 10.2102 int8
/model.19/act/Mul BPU id(0) HzLut 0.949350 15.5469 int8
/model.22/cv2.1/cv2.1.0/act/Mul BPU id(0) HzLut 0.959183 26.6397 int8
/model.22/cv3.1/cv3.1.0/act/Mul BPU id(0) HzLut 0.947452 16.2756 int8
/model.20/Concat BPU id(0) Concat 0.955208 12.6904 int8
/model.22/cv2.1/cv2.1.1/conv/Conv BPU id(0) HzSQuantizedConv 0.973773 12.8461 int8
/model.22/cv3.1/cv3.1.1/conv/Conv BPU id(0) HzSQuantizedConv 0.959533 16.2756 int8
/model.21/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.965582 12.6904 int8
/model.22/cv2.1/cv2.1.1/act/Mul BPU id(0) HzLut 0.972686 38.8051 int8
/model.22/cv3.1/cv3.1.1/act/Mul BPU id(0) HzLut 0.962370 27.0625 int8
/model.21/cv1/act/Mul BPU id(0) HzLut 0.930670 26.9658 int8
/model.22/cv2.1/cv2.1.2/Conv BPU id(0) HzSQuantizedConv 0.982384 38.8051 int8
/model.22/cv3.1/cv3.1.2/Conv BPU id(0) HzSQuantizedConv 0.997221 27.0625 int8
/model.21/Split BPU id(0) Split 0.907731 26.9658 int8
/model.22/Transpose_3 CPU – Transpose 0.997221 – float
/model.21/m.0/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.973496 26.9658 int8
/model.22/Cast_1 CPU – Cast 0.982382 – float
/model.22/Transpose_2 BPU id(2) Transpose 0.982381 – int32
/model.21/m.0/cv1/act/Mul BPU id(0) HzLut 0.936226 13.217 int8
/model.21/m.0/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.948926 13.0474 int8
/model.21/m.0/cv2/act/Mul BPU id(0) HzLut 0.930035 20.8819 int8
/model.21/Concat BPU id(0) Concat 0.929138 26.9658 int8
/model.21/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.968910 26.9658 int8
/model.21/cv2/act/Mul BPU id(0) HzLut 0.931118 28.0987 int8
/model.22/cv2.2/cv2.2.0/conv/Conv BPU id(0) HzSQuantizedConv 0.967374 12.5103 int8
/model.22/cv3.2/cv3.2.0/conv/Conv BPU id(0) HzSQuantizedConv 0.945861 12.5103 int8
/model.22/cv2.2/cv2.2.0/act/Mul BPU id(0) HzLut 0.962097 18.0222 int8
/model.22/cv3.2/cv3.2.0/act/Mul BPU id(0) HzLut 0.940411 18.0898 int8
/model.22/cv2.2/cv2.2.1/conv/Conv BPU id(0) HzSQuantizedConv 0.974884 13.5108 int8
/model.22/cv3.2/cv3.2.1/conv/Conv BPU id(0) HzSQuantizedConv 0.957014 18.0898 int8
/model.22/cv2.2/cv2.2.1/act/Mul BPU id(0) HzLut 0.977126 30.2404 int8
/model.22/cv3.2/cv3.2.1/act/Mul BPU id(0) HzLut 0.961369 24.3543 int8
/model.22/cv2.2/cv2.2.2/Conv BPU id(0) HzSQuantizedConv 0.986811 30.2404 int8
/model.22/cv3.2/cv3.2.2/Conv BPU id(0) HzSQuantizedConv 0.995059 24.3543 int8
/model.22/Transpose_5 CPU – Transpose 0.995059 – float
/model.22/Cast_2 CPU – Cast 0.986809 – float
/model.22/Transpose_4 BPU id(3) Transpose 0.986809 – int32
2026-04-19 13:34:50,798 INFO The quantized model output:

Output Cosine Similarity L1 Distance L2 Distance Chebyshev Distance

output0 0.998729 0.781872 0.005624 5.950317
326 0.977369 160.165664 0.350774 2116.000000
346 0.997221 0.998858 0.015075 8.503302
345 0.982381 156.367900 0.676232 1649.000000
365 0.995059 1.343915 0.040454 10.774521
364 0.986809 130.537617 1.141655 1228.000000
/model.12/cv1/conv/Conv_output_0_calibrated 0.975019 0.252503 0.000738 2.511135
/model.3/conv/Conv_output_0_calibrated 0.979115 0.233275 0.000486 2.461063
/model.16/conv/Conv_output_0_calibrated 0.972600 0.219721 0.000912 2.277494
/model.18/m.0/cv1/conv/Conv_output_0_calibrated 0.977141 0.219281 0.000912 1.893165
/model.21/cv2/conv/Conv_output_0_calibrated 0.968910 0.322370 0.001351 4.363921
…22/cv3.0/cv3.0.0/conv/Conv_output_0_calibrated 0.953848 0.277793 0.000563 2.621777
/model.6/cv2/conv/Conv_output_0_calibrated 0.983604 0.183870 0.000540 1.867956
/model.0/conv/Conv_output_0_calibrated 0.999674 0.164282 0.000155 1.125388
…22/cv3.2/cv3.2.0/conv/Conv_output_0_calibrated 0.945861 0.260684 0.002165 2.495770
/model.15/cv2/conv/Conv_output_0_calibrated 0.981353 0.167139 0.000370 2.664440
/model.6/m.1/cv2/conv/Conv_output_0_calibrated 0.983244 0.227658 0.000942 2.233948
/model.18/m.0/cv2/conv/Conv_output_0_calibrated 0.954741 0.329295 0.001383 4.252327
/model.12/m.0/cv2/conv/Conv_output_0_calibrated 0.968507 0.230943 0.000948 1.852372
/model.8/cv1/conv/Conv_output_0_calibrated 0.976055 0.255815 0.001100 3.405624
/model.15/m.0/cv2/conv/Conv_output_0_calibrated 0.974813 0.203983 0.000598 2.039910
/model.2/m.0/cv1/conv/Conv_output_0_calibrated 0.973426 0.664074 0.001345 5.966794
…22/cv2.2/cv2.2.0/conv/Conv_output_0_calibrated 0.967374 0.325191 0.002753 3.046483
/model.4/m.1/cv1/conv/Conv_output_0_calibrated 0.986461 0.182170 0.000530 1.639877
…22/cv2.1/cv2.1.1/conv/Conv_output_0_calibrated 0.973773 0.467690 0.002146 6.515526
/model.22/Mul_1_output_0 0.982384 156.425684 0.676498 1649.626587
/model.22/cv3.1/cv3.1.2/Conv_output_0 0.997221 0.998858 0.015075 8.503302
/model.12/cv2/conv/Conv_output_0_calibrated 0.973580 0.215075 0.000637 2.237457
/model.6/m.1/cv1/conv/Conv_output_0_calibrated 0.991775 0.166789 0.000687 1.351537
/model.9/cv2/conv/Conv_output_0_calibrated 0.988740 0.211105 0.000867 1.577188
/model.4/cv2/conv/Conv_output_0_calibrated 0.975511 0.198774 0.000419 2.247733
/model.21/m.0/cv2/conv/Conv_output_0_calibrated 0.948926 0.386217 0.002248 3.233368
/model.21/m.0/cv1/conv/Conv_output_0_calibrated 0.973496 0.410502 0.002364 2.825220
/model.4/cv1/conv/Conv_output_0_calibrated 0.974193 0.215698 0.000478 3.420748
/model.19/conv/Conv_output_0_calibrated 0.973306 0.208123 0.001257 2.670021
…22/cv3.0/cv3.0.1/conv/Conv_output_0_calibrated 0.963664 0.308197 0.000629 3.914468
/model.4/m.1/cv2/conv/Conv_output_0_calibrated 0.979726 0.261250 0.000763 2.605573
/model.4/m.0/cv1/conv/Conv_output_0_calibrated 0.980702 0.185108 0.000537 1.551460
/model.22/Mul_output_0 0.977380 160.228369 0.350925 2117.533936
/model.8/cv2/conv/Conv_output_0_calibrated 0.976409 0.273912 0.001128 2.709285
…22/cv2.0/cv2.0.0/conv/Conv_output_0_calibrated 0.972582 0.227280 0.000483 4.520002
/model.22/cv3.0/cv3.0.2/Conv_output_0 0.998729 0.781872 0.005624 5.950317
/model.15/m.0/cv1/conv/Conv_output_0_calibrated 0.981540 0.177114 0.000509 1.367150
/model.21/cv1/conv/Conv_output_0_calibrated 0.965582 0.287014 0.001178 2.701343
/model.18/cv2/conv/Conv_output_0_calibrated 0.972021 0.213626 0.000663 4.999544
/model.4/m.0/cv2/conv/Conv_output_0_calibrated 0.977899 0.194169 0.000576 2.161550
…22/cv2.0/cv2.0.1/conv/Conv_output_0_calibrated 0.965566 0.554000 0.001261 8.312881
/model.9/cv1/conv/Conv_output_0_calibrated 0.987272 0.209271 0.001232 2.115997
/model.6/m.0/cv2/conv/Conv_output_0_calibrated 0.986468 0.151182 0.000632 1.526753
/model.18/cv1/conv/Conv_output_0_calibrated 0.966772 0.245995 0.000717 2.227518
/model.15/cv1/conv/Conv_output_0_calibrated 0.983005 0.163386 0.000350 1.985267
…22/cv3.1/cv3.1.0/conv/Conv_output_0_calibrated 0.951763 0.264476 0.001095 2.639090
/model.2/cv1/conv/Conv_output_0_calibrated 0.991629 0.389134 0.000570 4.123837
…22/cv2.1/cv2.1.0/conv/Conv_output_0_calibrated 0.967496 0.315836 0.001382 4.240218
/model.22/Mul_2_output_0 0.986811 130.580586 1.142069 1228.014526
/model.7/conv/Conv_output_0_calibrated 0.984126 0.212133 0.000873 2.156533
/model.6/cv1/conv/Conv_output_0_calibrated 0.973792 0.220871 0.000718 3.916424
…22/cv3.2/cv3.2.1/conv/Conv_output_0_calibrated 0.957014 0.311338 0.002642 3.931762
/model.6/m.0/cv1/conv/Conv_output_0_calibrated 0.989715 0.194494 0.000794 1.617946
/model.8/m.0/cv1/conv/Conv_output_0_calibrated 0.983855 0.256478 0.001497 1.990933
/model.5/conv/Conv_output_0_calibrated 0.984018 0.178123 0.000526 2.231535
/model.2/cv2/conv/Conv_output_0_calibrated 0.981447 0.313820 0.000464 3.433216
/model.1/conv/Conv_output_0_calibrated 0.995303 0.593907 0.000832 5.066320
…22/cv3.1/cv3.1.1/conv/Conv_output_0_calibrated 0.959533 0.284276 0.001212 4.069573
/model.2/m.0/cv2/conv/Conv_output_0_calibrated 0.957869 0.747426 0.001605 9.093879
/model.12/m.0/cv1/conv/Conv_output_0_calibrated 0.982063 0.223523 0.000906 1.597455
/model.22/cv3.2/cv3.2.2/Conv_output_0 0.995059 1.343915 0.040454 10.774521
…22/cv2.2/cv2.2.1/conv/Conv_output_0_calibrated 0.974884 0.433157 0.003879 5.338984
/model.8/m.0/cv2/conv/Conv_output_0_calibrated 0.972421 0.361278 0.002092 3.020632
2026-04-19 13:34:50,810 INFO End to Horizon NN Model Convert.
2026-04-19 13:34:50,828 INFO start convert to *.bin file…
2026-04-19 13:34:50,845 INFO ONNX model output num : 69
2026-04-19 13:34:50,851 INFO ############# model deps info #############
2026-04-19 13:34:50,852 INFO hb_mapper version : 1.24.3
2026-04-19 13:34:50,853 INFO hbdk version : 3.49.15
2026-04-19 13:34:50,853 INFO hbdk runtime version: 3.15.55.0
2026-04-19 13:34:50,854 INFO horizon_nn version : 1.1.0
2026-04-19 13:34:50,854 INFO ############# model_parameters info #############
2026-04-19 13:34:50,855 INFO onnx_model : /data/best.onnx
2026-04-19 13:34:50,856 INFO BPU march : bayes-e
2026-04-19 13:34:50,856 INFO layer_out_dump : True
2026-04-19 13:34:50,857 INFO log_level : DEBUG
2026-04-19 13:34:50,857 INFO working dir : /data/model_output
2026-04-19 13:34:50,858 INFO output_model_file_prefix: yolov8_cow
2026-04-19 13:34:50,859 INFO ############# input_parameters info #############
2026-04-19 13:34:50,859 INFO ------------------------------------------
2026-04-19 13:34:50,860 INFO ---------input info : images ---------
2026-04-19 13:34:50,861 INFO input_name : images
2026-04-19 13:34:50,862 INFO input_type_rt : nv12
2026-04-19 13:34:50,863 INFO input_space&range : regular
2026-04-19 13:34:50,864 INFO input_layout_rt : None
2026-04-19 13:34:50,865 INFO input_type_train : rgb
2026-04-19 13:34:50,865 INFO input_layout_train : NCHW
2026-04-19 13:34:50,866 INFO norm_type : data_scale
2026-04-19 13:34:50,867 INFO input_shape : 1x3x640x640
2026-04-19 13:34:50,868 INFO scale_value : 0.003921568627451,
2026-04-19 13:34:50,869 INFO cal_data_dir : /data/cal_bin
2026-04-19 13:34:50,869 INFO cal_data_type : float32
2026-04-19 13:34:50,870 INFO ---------input info : images end -------
2026-04-19 13:34:50,870 INFO ------------------------------------------
2026-04-19 13:34:50,871 INFO ############# calibration_parameters info #############
2026-04-19 13:34:50,871 INFO preprocess_on : False
2026-04-19 13:34:50,872 INFO calibration_type: : default
2026-04-19 13:34:50,872 INFO per_channel : False
2026-04-19 13:34:50,873 INFO ############# compiler_parameters info #############
2026-04-19 13:34:50,873 INFO debug : True
2026-04-19 13:34:50,874 INFO compile_mode : latency
2026-04-19 13:34:50,874 INFO hbdk_pass_through_params: --O3 --debug --core-num 1 --fast
2026-04-19 13:34:50,875 INFO input-source : {‘images’: ‘pyramid’, ‘_default_value’: ‘ddr’}
2026-04-19 13:34:50,905 INFO Convert to runtime bin file successfully!
2026-04-19 13:34:50,906 INFO End Model Convert

hrt_model_exec的日志如下:

root@ubuntu:/home/sunrise/yolov8# hrt_model_exec model_info --model_file=./cow6.bin hrt_model_exec model_info --model_file=./cow6.bin

I0000 00:00:00.000000 76065 vlog_is_on.cc:197] RAW: Set VLOG level for “*” to 3
[BPU_PLAT]BPU Platform Version(1.3.6)! soc info(x5)
[HBRT] set log level as 0. version = 3.15.55.0
[DNN] Runtime version = 1.24.5_(3.15.55 HBRT)
[A][DNN][packed_model.cpp:247]Model [HorizonRT] The model builder version = 1.24.3
Load model to DDR cost 184.429ms.
This model file has 1 model:
[yolov8_cow]

input[0]:
name: images
input source: HB_DNN_INPUT_FROM_PYRAMID
valid shape: (1,3,640,640,)
aligned shape: (1,3,640,640,)
aligned byte size: 614400
tensor type: HB_DNN_IMG_TYPE_NV12
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (0,0,0,0,)

output[0]:
name: output0
valid shape: (1,80,80,5,)
aligned shape: (1,80,80,5,)
aligned byte size: 128000
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NHWC
quanti type: NONE
stride: (128000,1600,20,4,)

output[1]:
name: 326
valid shape: (1,80,80,64,)
aligned shape: (1,80,80,64,)
aligned byte size: 1638400
tensor type: HB_DNN_TENSOR_TYPE_S32
tensor layout: HB_DNN_LAYOUT_NONE
quanti type: NONE
stride: (1638400,20480,256,4,)

output[2]:
name: 346
valid shape: (1,40,40,5,)
aligned shape: (1,40,40,5,)
aligned byte size: 32000
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NHWC
quanti type: NONE
stride: (32000,800,20,4,)

output[3]:
name: 345
valid shape: (1,40,40,64,)
aligned shape: (1,40,40,64,)
aligned byte size: 409600
tensor type: HB_DNN_TENSOR_TYPE_S32
tensor layout: HB_DNN_LAYOUT_NONE
quanti type: NONE
stride: (409600,10240,256,4,)

output[4]:
name: 365
valid shape: (1,20,20,5,)
aligned shape: (1,20,20,5,)
aligned byte size: 8000
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NHWC
quanti type: NONE
stride: (8000,400,20,4,)

output[5]:
name: 364
valid shape: (1,20,20,64,)
aligned shape: (1,20,20,64,)
aligned byte size: 102400
tensor type: HB_DNN_TENSOR_TYPE_S32
tensor layout: HB_DNN_LAYOUT_NONE
quanti type: NONE
stride: (102400,5120,256,4,)

output[6]:
name: /model.12/cv1/conv/Conv_output_0_calibrated
valid shape: (1,128,40,40,)
aligned shape: (1,128,40,40,)
aligned byte size: 819200
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (819200,6400,160,4,)

output[7]:
name: /model.3/conv/Conv_output_0_calibrated
valid shape: (1,64,80,80,)
aligned shape: (1,64,80,80,)
aligned byte size: 1638400
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (1638400,25600,320,4,)

output[8]:
name: /model.16/conv/Conv_output_0_calibrated
valid shape: (1,64,40,40,)
aligned shape: (1,64,40,40,)
aligned byte size: 409600
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (409600,6400,160,4,)

output[9]:
name: /model.18/m.0/cv1/conv/Conv_output_0_calibrated
valid shape: (1,64,40,40,)
aligned shape: (1,64,40,40,)
aligned byte size: 409600
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (409600,6400,160,4,)

output[10]:
name: /model.21/cv2/conv/Conv_output_0_calibrated
valid shape: (1,256,20,20,)
aligned shape: (1,256,20,20,)
aligned byte size: 409600
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (409600,1600,80,4,)

output[11]:
name: /model.22/cv3.0/cv3.0.0/conv/Conv_output_0_calibrated
valid shape: (1,64,80,80,)
aligned shape: (1,64,80,80,)
aligned byte size: 1638400
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (1638400,25600,320,4,)

output[12]:
name: /model.6/cv2/conv/Conv_output_0_calibrated
valid shape: (1,128,40,40,)
aligned shape: (1,128,40,40,)
aligned byte size: 819200
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (819200,6400,160,4,)

output[13]:
name: /model.0/conv/Conv_output_0_calibrated
valid shape: (1,16,320,320,)
aligned shape: (1,16,320,320,)
aligned byte size: 6553600
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (6553600,409600,1280,4,)

output[14]:
name: /model.22/cv3.2/cv3.2.0/conv/Conv_output_0_calibrated
valid shape: (1,64,20,20,)
aligned shape: (1,64,20,20,)
aligned byte size: 102400
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (102400,1600,80,4,)

output[15]:
name: /model.15/cv2/conv/Conv_output_0_calibrated
valid shape: (1,64,80,80,)
aligned shape: (1,64,80,80,)
aligned byte size: 1638400
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (1638400,25600,320,4,)

output[16]:
name: /model.6/m.1/cv2/conv/Conv_output_0_calibrated
valid shape: (1,64,40,40,)
aligned shape: (1,64,40,40,)
aligned byte size: 409600
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (409600,6400,160,4,)

output[17]:
name: /model.18/m.0/cv2/conv/Conv_output_0_calibrated
valid shape: (1,64,40,40,)
aligned shape: (1,64,40,40,)
aligned byte size: 409600
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (409600,6400,160,4,)

output[18]:
name: /model.12/m.0/cv2/conv/Conv_output_0_calibrated
valid shape: (1,64,40,40,)
aligned shape: (1,64,40,40,)
aligned byte size: 409600
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (409600,6400,160,4,)

output[19]:
name: /model.8/cv1/conv/Conv_output_0_calibrated
valid shape: (1,256,20,20,)
aligned shape: (1,256,20,20,)
aligned byte size: 409600
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (409600,1600,80,4,)

output[20]:
name: /model.15/m.0/cv2/conv/Conv_output_0_calibrated
valid shape: (1,32,80,80,)
aligned shape: (1,32,80,80,)
aligned byte size: 819200
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (819200,25600,320,4,)

output[21]:
name: /model.2/m.0/cv1/conv/Conv_output_0_calibrated
valid shape: (1,16,160,160,)
aligned shape: (1,16,160,160,)
aligned byte size: 1638400
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (1638400,102400,640,4,)

output[22]:
name: /model.22/cv2.2/cv2.2.0/conv/Conv_output_0_calibrated
valid shape: (1,64,20,20,)
aligned shape: (1,64,20,20,)
aligned byte size: 102400
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (102400,1600,80,4,)

output[23]:
name: /model.4/m.1/cv1/conv/Conv_output_0_calibrated
valid shape: (1,32,80,80,)
aligned shape: (1,32,80,80,)
aligned byte size: 819200
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (819200,25600,320,4,)

output[24]:
name: /model.22/cv2.1/cv2.1.1/conv/Conv_output_0_calibrated
valid shape: (1,64,40,40,)
aligned shape: (1,64,40,40,)
aligned byte size: 409600
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (409600,6400,160,4,)

output[25]:
name: /model.22/Mul_1_output_0
valid shape: (1,64,40,40,)
aligned shape: (1,64,40,40,)
aligned byte size: 409600
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (409600,6400,160,4,)

output[26]:
name: /model.22/cv3.1/cv3.1.2/Conv_output_0
valid shape: (1,5,40,40,)
aligned shape: (1,5,40,40,)
aligned byte size: 32000
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (32000,6400,160,4,)

output[27]:
name: /model.12/cv2/conv/Conv_output_0_calibrated
valid shape: (1,128,40,40,)
aligned shape: (1,128,40,40,)
aligned byte size: 819200
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (819200,6400,160,4,)

output[28]:
name: /model.6/m.1/cv1/conv/Conv_output_0_calibrated
valid shape: (1,64,40,40,)
aligned shape: (1,64,40,40,)
aligned byte size: 409600
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (409600,6400,160,4,)

output[29]:
name: /model.9/cv2/conv/Conv_output_0_calibrated
valid shape: (1,256,20,20,)
aligned shape: (1,256,20,20,)
aligned byte size: 409600
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (409600,1600,80,4,)

output[30]:
name: /model.4/cv2/conv/Conv_output_0_calibrated
valid shape: (1,64,80,80,)
aligned shape: (1,64,80,80,)
aligned byte size: 1638400
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (1638400,25600,320,4,)

output[31]:
name: /model.21/m.0/cv2/conv/Conv_output_0_calibrated
valid shape: (1,128,20,20,)
aligned shape: (1,128,20,20,)
aligned byte size: 204800
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (204800,1600,80,4,)

output[32]:
name: /model.21/m.0/cv1/conv/Conv_output_0_calibrated
valid shape: (1,128,20,20,)
aligned shape: (1,128,20,20,)
aligned byte size: 204800
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (204800,1600,80,4,)

output[33]:
name: /model.4/cv1/conv/Conv_output_0_calibrated
valid shape: (1,64,80,80,)
aligned shape: (1,64,80,80,)
aligned byte size: 1638400
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (1638400,25600,320,4,)

output[34]:
name: /model.19/conv/Conv_output_0_calibrated
valid shape: (1,128,20,20,)
aligned shape: (1,128,20,20,)
aligned byte size: 204800
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (204800,1600,80,4,)

output[35]:
name: /model.22/cv3.0/cv3.0.1/conv/Conv_output_0_calibrated
valid shape: (1,64,80,80,)
aligned shape: (1,64,80,80,)
aligned byte size: 1638400
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (1638400,25600,320,4,)

output[36]:
name: /model.4/m.1/cv2/conv/Conv_output_0_calibrated
valid shape: (1,32,80,80,)
aligned shape: (1,32,80,80,)
aligned byte size: 819200
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (819200,25600,320,4,)

output[37]:
name: /model.4/m.0/cv1/conv/Conv_output_0_calibrated
valid shape: (1,32,80,80,)
aligned shape: (1,32,80,80,)
aligned byte size: 819200
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (819200,25600,320,4,)

output[38]:
name: /model.22/Mul_output_0
valid shape: (1,64,80,80,)
aligned shape: (1,64,80,80,)
aligned byte size: 1638400
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (1638400,25600,320,4,)

output[39]:
name: /model.8/cv2/conv/Conv_output_0_calibrated
valid shape: (1,256,20,20,)
aligned shape: (1,256,20,20,)
aligned byte size: 409600
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (409600,1600,80,4,)

output[40]:
name: /model.22/cv2.0/cv2.0.0/conv/Conv_output_0_calibrated
valid shape: (1,64,80,80,)
aligned shape: (1,64,80,80,)
aligned byte size: 1638400
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (1638400,25600,320,4,)

output[41]:
name: /model.22/cv3.0/cv3.0.2/Conv_output_0
valid shape: (1,5,80,80,)
aligned shape: (1,5,80,80,)
aligned byte size: 128000
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (128000,25600,320,4,)

output[42]:
name: /model.15/m.0/cv1/conv/Conv_output_0_calibrated
valid shape: (1,32,80,80,)
aligned shape: (1,32,80,80,)
aligned byte size: 819200
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (819200,25600,320,4,)

output[43]:
name: /model.21/cv1/conv/Conv_output_0_calibrated
valid shape: (1,256,20,20,)
aligned shape: (1,256,20,20,)
aligned byte size: 409600
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (409600,1600,80,4,)

output[44]:
name: /model.18/cv2/conv/Conv_output_0_calibrated
valid shape: (1,128,40,40,)
aligned shape: (1,128,40,40,)
aligned byte size: 819200
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (819200,6400,160,4,)

output[45]:
name: /model.4/m.0/cv2/conv/Conv_output_0_calibrated
valid shape: (1,32,80,80,)
aligned shape: (1,32,80,80,)
aligned byte size: 819200
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (819200,25600,320,4,)

output[46]:
name: /model.22/cv2.0/cv2.0.1/conv/Conv_output_0_calibrated
valid shape: (1,64,80,80,)
aligned shape: (1,64,80,80,)
aligned byte size: 1638400
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (1638400,25600,320,4,)

output[47]:
name: /model.9/cv1/conv/Conv_output_0_calibrated
valid shape: (1,128,20,20,)
aligned shape: (1,128,20,20,)
aligned byte size: 204800
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (204800,1600,80,4,)

output[48]:
name: /model.6/m.0/cv2/conv/Conv_output_0_calibrated
valid shape: (1,64,40,40,)
aligned shape: (1,64,40,40,)
aligned byte size: 409600
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (409600,6400,160,4,)

output[49]:
name: /model.18/cv1/conv/Conv_output_0_calibrated
valid shape: (1,128,40,40,)
aligned shape: (1,128,40,40,)
aligned byte size: 819200
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (819200,6400,160,4,)

output[50]:
name: /model.15/cv1/conv/Conv_output_0_calibrated
valid shape: (1,64,80,80,)
aligned shape: (1,64,80,80,)
aligned byte size: 1638400
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (1638400,25600,320,4,)

output[51]:
name: /model.22/cv3.1/cv3.1.0/conv/Conv_output_0_calibrated
valid shape: (1,64,40,40,)
aligned shape: (1,64,40,40,)
aligned byte size: 409600
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (409600,6400,160,4,)

output[52]:
name: /model.2/cv1/conv/Conv_output_0_calibrated
valid shape: (1,32,160,160,)
aligned shape: (1,32,160,160,)
aligned byte size: 3276800
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (3276800,102400,640,4,)

output[53]:
name: /model.22/cv2.1/cv2.1.0/conv/Conv_output_0_calibrated
valid shape: (1,64,40,40,)
aligned shape: (1,64,40,40,)
aligned byte size: 409600
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (409600,6400,160,4,)

output[54]:
name: /model.22/Mul_2_output_0
valid shape: (1,64,20,20,)
aligned shape: (1,64,20,20,)
aligned byte size: 102400
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (102400,1600,80,4,)

output[55]:
name: /model.7/conv/Conv_output_0_calibrated
valid shape: (1,256,20,20,)
aligned shape: (1,256,20,20,)
aligned byte size: 409600
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (409600,1600,80,4,)

output[56]:
name: /model.6/cv1/conv/Conv_output_0_calibrated
valid shape: (1,128,40,40,)
aligned shape: (1,128,40,40,)
aligned byte size: 819200
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (819200,6400,160,4,)

output[57]:
name: /model.22/cv3.2/cv3.2.1/conv/Conv_output_0_calibrated
valid shape: (1,64,20,20,)
aligned shape: (1,64,20,20,)
aligned byte size: 102400
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (102400,1600,80,4,)

output[58]:
name: /model.6/m.0/cv1/conv/Conv_output_0_calibrated
valid shape: (1,64,40,40,)
aligned shape: (1,64,40,40,)
aligned byte size: 409600
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (409600,6400,160,4,)

output[59]:
name: /model.8/m.0/cv1/conv/Conv_output_0_calibrated
valid shape: (1,128,20,20,)
aligned shape: (1,128,20,20,)
aligned byte size: 204800
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (204800,1600,80,4,)

output[60]:
name: /model.5/conv/Conv_output_0_calibrated
valid shape: (1,128,40,40,)
aligned shape: (1,128,40,40,)
aligned byte size: 819200
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (819200,6400,160,4,)

output[61]:
name: /model.2/cv2/conv/Conv_output_0_calibrated
valid shape: (1,32,160,160,)
aligned shape: (1,32,160,160,)
aligned byte size: 3276800
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (3276800,102400,640,4,)

output[62]:
name: /model.1/conv/Conv_output_0_calibrated
valid shape: (1,32,160,160,)
aligned shape: (1,32,160,160,)
aligned byte size: 3276800
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (3276800,102400,640,4,)

output[63]:
name: /model.22/cv3.1/cv3.1.1/conv/Conv_output_0_calibrated
valid shape: (1,64,40,40,)
aligned shape: (1,64,40,40,)
aligned byte size: 409600
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (409600,6400,160,4,)

output[64]:
name: /model.2/m.0/cv2/conv/Conv_output_0_calibrated
valid shape: (1,16,160,160,)
aligned shape: (1,16,160,160,)
aligned byte size: 1638400
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (1638400,102400,640,4,)

output[65]:
name: /model.12/m.0/cv1/conv/Conv_output_0_calibrated
valid shape: (1,64,40,40,)
aligned shape: (1,64,40,40,)
aligned byte size: 409600
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (409600,6400,160,4,)

output[66]:
name: /model.22/cv3.2/cv3.2.2/Conv_output_0
valid shape: (1,5,20,20,)
aligned shape: (1,5,20,20,)
aligned byte size: 8000
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (8000,1600,80,4,)

output[67]:
name: /model.22/cv2.2/cv2.2.1/conv/Conv_output_0_calibrated
valid shape: (1,64,20,20,)
aligned shape: (1,64,20,20,)
aligned byte size: 102400
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (102400,1600,80,4,)

output[68]:
name: /model.8/m.0/cv2/conv/Conv_output_0_calibrated
valid shape: (1,128,20,20,)
aligned shape: (1,128,20,20,)
aligned byte size: 204800
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (204800,1600,80,4,)

运行tros如下

root@ubuntu:/home/sunrise/yolov8# ros2 launch dnn_node_example dnn_node_example_feedback.launch.py dnn_example_config_file:=my_config/yolov8workconfig.json dnn_example_image:=my_config/target.jpg
[INFO] [launch]: All log files can be found below /root/.ros/log/2026-04-19-13-42-26-517237-ubuntu-76735
[INFO] [launch]: Default logging verbosity is set to INFO
dnn_node_example_path is /opt/tros/humble/lib/dnn_node_example
cp_cmd is cp -r /opt/tros/humble/lib/dnn_node_example/config .
[INFO] [example-1]: process started with pid [76752]
[example-1] [WARN] [1776577347.119003195] [dnn_example_node]: Parameter:
[example-1] feed_type(0:local, 1:sub): 0
[example-1] image: my_config/target.jpg
[example-1] image_type: 0
[example-1] dump_render_img: 1
[example-1] is_shared_mem_sub: 0
[example-1] config_file: my_config/yolov8workconfig.json
[example-1] msg_pub_topic_name: hobot_dnn_detection
[example-1] info_msg_pub_topic_name: hobot_dnn_detection_info
[example-1] ros_img_topic_name: /image
[example-1] sharedmem_img_topic_name: /hbmem_img
[example-1] [WARN] [1776577347.119595279] [dnn_example_node]: Load [5] class types from file [my_config/cow.list]
[example-1] [WARN] [1776577347.119719280] [dnn_example_node]: Parameter:
[example-1] model_file_name: /home/sunrise/yolov8/cow6.bin
[example-1] model_name:
[example-1] [INFO] [1776577347.119801821] [dnn]: Node init.
[example-1] [INFO] [1776577347.119825946] [dnn_example_node]: Set node para.
[example-1] [WARN] [1776577347.119865113] [dnn_example_node]: model_file_name_: /home/sunrise/yolov8/cow6.bin, task_num: 4
[example-1] [INFO] [1776577347.119911863] [dnn]: Model init.
[example-1] [BPU_PLAT]BPU Platform Version(1.3.6)! soc info(x5)
[example-1] [HBRT] set log level as 0. version = 3.15.55.0
[example-1] [DNN] Runtime version = 1.24.5_(3.15.55 HBRT)
[example-1] [A][DNN][packed_model.cpp:247]Model [HorizonRT] The model builder version = 1.24.3
[example-1] [INFO] [1776577347.305772601] [dnn]: The model input 0 width is 640 and height is 640
[example-1] [INFO] [1776577347.306448727] [dnn]:
[example-1] Model Info:
[example-1] name: yolov8_cow.
[example-1] [input]
[example-1] - (0) Layout: NCHW, Shape: [1, 3, 640, 640], Type: HB_DNN_IMG_TYPE_NV12.
[example-1] [output]
[example-1] - (0) Layout: NHWC, Shape: [1, 80, 80, 5], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (1) Layout: NONE, Shape: [1, 80, 80, 64], Type: HB_DNN_TENSOR_TYPE_S32.
[example-1] - (2) Layout: NHWC, Shape: [1, 40, 40, 5], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (3) Layout: NONE, Shape: [1, 40, 40, 64], Type: HB_DNN_TENSOR_TYPE_S32.
[example-1] - (4) Layout: NHWC, Shape: [1, 20, 20, 5], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (5) Layout: NONE, Shape: [1, 20, 20, 64], Type: HB_DNN_TENSOR_TYPE_S32.
[example-1] - (6) Layout: NCHW, Shape: [1, 128, 40, 40], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (7) Layout: NCHW, Shape: [1, 64, 80, 80], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (8) Layout: NCHW, Shape: [1, 64, 40, 40], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (9) Layout: NCHW, Shape: [1, 64, 40, 40], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (10) Layout: NCHW, Shape: [1, 256, 20, 20], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (11) Layout: NCHW, Shape: [1, 64, 80, 80], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (12) Layout: NCHW, Shape: [1, 128, 40, 40], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (13) Layout: NCHW, Shape: [1, 16, 320, 320], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (14) Layout: NCHW, Shape: [1, 64, 20, 20], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (15) Layout: NCHW, Shape: [1, 64, 80, 80], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (16) Layout: NCHW, Shape: [1, 64, 40, 40], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (17) Layout: NCHW, Shape: [1, 64, 40, 40], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (18) Layout: NCHW, Shape: [1, 64, 40, 40], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (19) Layout: NCHW, Shape: [1, 256, 20, 20], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (20) Layout: NCHW, Shape: [1, 32, 80, 80], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (21) Layout: NCHW, Shape: [1, 16, 160, 160], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (22) Layout: NCHW, Shape: [1, 64, 20, 20], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (23) Layout: NCHW, Shape: [1, 32, 80, 80], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (24) Layout: NCHW, Shape: [1, 64, 40, 40], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (25) Layout: NCHW, Shape: [1, 64, 40, 40], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (26) Layout: NCHW, Shape: [1, 5, 40, 40], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (27) Layout: NCHW, Shape: [1, 128, 40, 40], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (28) Layout: NCHW, Shape: [1, 64, 40, 40], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (29) Layout: NCHW, Shape: [1, 256, 20, 20], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (30) Layout: NCHW, Shape: [1, 64, 80, 80], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (31) Layout: NCHW, Shape: [1, 128, 20, 20], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (32) Layout: NCHW, Shape: [1, 128, 20, 20], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (33) Layout: NCHW, Shape: [1, 64, 80, 80], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (34) Layout: NCHW, Shape: [1, 128, 20, 20], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (35) Layout: NCHW, Shape: [1, 64, 80, 80], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (36) Layout: NCHW, Shape: [1, 32, 80, 80], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (37) Layout: NCHW, Shape: [1, 32, 80, 80], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (38) Layout: NCHW, Shape: [1, 64, 80, 80], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (39) Layout: NCHW, Shape: [1, 256, 20, 20], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (40) Layout: NCHW, Shape: [1, 64, 80, 80], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (41) Layout: NCHW, Shape: [1, 5, 80, 80], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (42) Layout: NCHW, Shape: [1, 32, 80, 80], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (43) Layout: NCHW, Shape: [1, 256, 20, 20], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (44) Layout: NCHW, Shape: [1, 128, 40, 40], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (45) Layout: NCHW, Shape: [1, 32, 80, 80], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (46) Layout: NCHW, Shape: [1, 64, 80, 80], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (47) Layout: NCHW, Shape: [1, 128, 20, 20], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (48) Layout: NCHW, Shape: [1, 64, 40, 40], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (49) Layout: NCHW, Shape: [1, 128, 40, 40], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (50) Layout: NCHW, Shape: [1, 64, 80, 80], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (51) Layout: NCHW, Shape: [1, 64, 40, 40], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (52) Layout: NCHW, Shape: [1, 32, 160, 160], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (53) Layout: NCHW, Shape: [1, 64, 40, 40], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (54) Layout: NCHW, Shape: [1, 64, 20, 20], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (55) Layout: NCHW, Shape: [1, 256, 20, 20], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (56) Layout: NCHW, Shape: [1, 128, 40, 40], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (57) Layout: NCHW, Shape: [1, 64, 20, 20], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (58) Layout: NCHW, Shape: [1, 64, 40, 40], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (59) Layout: NCHW, Shape: [1, 128, 20, 20], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (60) Layout: NCHW, Shape: [1, 128, 40, 40], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (61) Layout: NCHW, Shape: [1, 32, 160, 160], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (62) Layout: NCHW, Shape: [1, 32, 160, 160], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (63) Layout: NCHW, Shape: [1, 64, 40, 40], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (64) Layout: NCHW, Shape: [1, 16, 160, 160], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (65) Layout: NCHW, Shape: [1, 64, 40, 40], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (66) Layout: NCHW, Shape: [1, 5, 20, 20], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (67) Layout: NCHW, Shape: [1, 64, 20, 20], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (68) Layout: NCHW, Shape: [1, 128, 20, 20], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1]
[example-1] [INFO] [1776577347.307014061] [dnn]: Task init.
[example-1] [INFO] [1776577347.308873730] [dnn]: Set task_num [4]
[example-1] [WARN] [1776577347.309022147] [dnn_example_node]: Get model name: yolov8_cow from load model.
[example-1] [INFO] [1776577347.309144647] [dnn_example_node]: The model input width is 640 and height is 640
[example-1] [WARN] [1776577347.309201564] [dnn_example_node]: Create ai msg publisher with topic_name: hobot_dnn_detection
[example-1] [INFO] [1776577347.322635165] [dnn_example_node]: Dnn node feed with local image: my_config/target.jpg
[example-1] [INFO] [1776577347.432357722] [dnn_example_node]: Output from frame_id: feedback, stamp: 0.0
[example-1] [ERROR] [1776577347.432572014] [dnn_example_node]: Inlvaid parser: 0

其中我的yolov8workconfig.json如下:

{
“model_file”: “/home/sunrise/yolov8/cow6.bin”,
“task_num”: 4,
“dnn_parser”: “yolov8”,
“model_output_count”: 6,
“reg_max”: 16,
“class_num”: 5,
“cls_names_list”: “my_config/cow.list”,
“strides”: [8, 16, 32],
“score_threshold”: 0.25,
“nms_threshold”: 0.7,
“nms_top_k”: 300,
“output_order”: [0, 1, 2, 3, 4, 5]
}
方案二我已经检查过了,附上我的py文件

Copyright (c) 2025 D-Robotics Corporation

Licensed under the Apache License, Version 2.0 (the “License”);

you may not use this file except in compliance with the License.

You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software

distributed under the License is distributed on an “AS IS” BASIS,

WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

See the License for the specific language governing permissions and

limitations under the License.

“”"YOLO26 Detection ONNX Export Script.

This script exports a YOLO26 detection model to a BPU-optimized ONNX format.
It modifies the `Detect` head to output raw feature maps in NHWC layout.

Usage:
python3 export_yolo26_detect_bpu.py --weights yolo26n.pt --output yolo26n_det_bpu.onnx
“”"

import os
import shutil
import argparse
import torch
from ultralytics import YOLO
from ultralytics.nn.modules import Detect

def main():
“”“Main entry point for detection model export.”“”
parser = argparse.ArgumentParser(description=“YOLO26 Detect Export Script”)
parser.add_argument(‘–weights’, type=str, required=True, help=‘Path to YOLO26 .pt model’)
parser.add_argument(‘–output’, type=str, default=‘yolo26_det_bpu.onnx’, help=‘Output ONNX path’)
parser.add_argument(‘–imgsz’, type=int, default=640, help=‘Input image size’)

args = parser.parse_args()

export_bpu_onnx(args.weights, args.output, args.imgsz)

def bpu_detect_forward(self, x):
result = []
for i in range(self.nl):
# bbox 分支:保持 float32,不要转 int32!
bbox = self.cv2[i](x[i]) # (B, 4*reg_max, H, W)

    # cls 分支:保持 float32
    cls = self.cv3\[i\](x\[i\])  # (B, nc, H, W)

    # 关键:先 permute 再调整顺序
    # 1. NCHW -> NHWC
    bbox = bbox.permute(0, 2, 3, 1).contiguous()  # (B, H, W, 4\*reg_max)
    cls = cls.permute(0, 2, 3, 1).contiguous()  # (B, H, W, nc)

    # 2. 输出顺序:先 cls 后 bbox(匹配官方)
    result.append(cls)
    result.append(bbox)
return result

def export_bpu_onnx(model_path: str, output_name: str = “yolo26_bpu.onnx”, imgsz: int = 640):
“”“Export YOLO26 model to BPU-friendly ONNX.”“”
print(f"Loading model: {model_path}…“)
try:
model = YOLO(model_path)
except Exception as e:
print(f"Error loading model: {e}”)
return

print("Applying BPU Monkey Patch (Output Layout: NHWC)...")
Detect.forward = bpu_detect_forward

print(f"Starting export (imgsz={imgsz})...")
try:
    exported_path = model.export(
        format="onnx",
        imgsz=imgsz,
        dynamic=False,
        opset=11,
        simplify=True
    )
except Exception as e:
    print(f"Export exception: {e}")
    return

if exported_path:
    if output_name and exported_path != output_name:
        out_dir = os.path.dirname(output_name)
        if out_dir:
            os.makedirs(out_dir, exist_ok=True)
        shutil.move(exported_path, output_name)
        print(f"Renamed output to: {output_name}")
        return output_name
    return exported_path
else:
    print("❌ Export failed.")
    return None

if _name_ == “_main_”:
main()

关于方案三,我使用export_monkey_patch.py,加上imgsz导出640大小的onnx,使用hb_mapper导出bin的时候通过日志发现模型是NHWC格式,并且bbox是F32而不是S32
附上日志:
root@46a86a8809fe:/data# hb_mapper makertbin --model-type onnx --config yolov8.yaml
2026-04-19 13:45:31,533 INFO log will be stored in /data/hb_mapper_makertbin.log
2026-04-19 13:45:31,534 INFO Start hb_mapper…
2026-04-19 13:45:31,535 INFO hbdk version 3.49.15
2026-04-19 13:45:31,536 INFO horizon_nn version 1.1.0
2026-04-19 13:45:31,537 INFO hb_mapper version 1.24.3
2026-04-19 13:45:31,537 INFO Start Model Convert…
2026-04-19 13:45:31,543 INFO Using onnx model file: /data/best.onnx
2026-04-19 13:45:31,620 INFO Model has 1 inputs according to model file
2026-04-19 13:45:31,623 INFO Model input shape not given in yaml_file, using shape from model file: [[1, 3, 640, 640]]
2026-04-19 13:45:31,623 INFO nv12 input type rt received.
2026-04-19 13:45:31,626 WARNING The calibration dir name suffix is not the same as the value float32 of the parameter cal_data_type, the parameter setting will prevail
2026-04-19 13:45:31,628 INFO custom_op does not exist, skipped
2026-04-19 13:45:31,631 WARNING Input node images’s input_source not set, it will be set to pyramid by default
2026-04-19 13:45:31,640 INFO *******************************************
2026-04-19 13:45:31,641 INFO First calibration picture name: 000d64dae0250e8b.bin
2026-04-19 13:45:31,641 INFO First calibration picture md5:
056d797381f1224d368ed8c3fc8c71db /data/cal_bin/000d64dae0250e8b.bin
2026-04-19 13:45:31,687 INFO *******************************************
2026-04-19 13:45:40,032 INFO Start to Horizon NN Model Convert.
2026-04-19 13:45:40,110 INFO Loading horizon_nn debug methods:{‘dump_all_layers_output’, ‘dump_all_models’, ‘check_model_output_consistency’}
2026-04-19 13:45:40,112 INFO The activation calibration parameters:
calibration_type: [‘max’, ‘kl’]
max_percentile: [0.99995, 1.0]
per_channel: [True, False]
asymmetric: [True, False]
The modelwise search parameters:
similarity: 0.995
metric: cosine-similarity
2026-04-19 13:45:40,113 INFO input images is from pyramid. Its layout is set to NHWC
2026-04-19 13:45:40,114 INFO The specified model compilation architecture: bayes-e.
2026-04-19 13:45:40,115 INFO The specified model compilation optimization parameters: .
2026-04-19 13:45:40,118 INFO Start to prepare the onnx model.
2026-04-19 13:45:40,127 INFO Input ONNX Model Information:
ONNX IR version: 6
Opset version: [‘ai.onnx v11’, ‘horizon v1’]
Producer: pytorch v2.10.0
Domain: None
Version: None
Graph input:
images: shape=[1, 3, 640, 640], dtype=FLOAT32
Graph output:
output0: shape=[1, 80, 80, 5], dtype=FLOAT32
324: shape=[1, 80, 80, 64], dtype=FLOAT32
332: shape=[1, 40, 40, 5], dtype=FLOAT32
340: shape=[1, 40, 40, 64], dtype=FLOAT32
348: shape=[1, 20, 20, 5], dtype=FLOAT32
356: shape=[1, 20, 20, 64], dtype=FLOAT32
2026-04-19 13:45:40,318 INFO End to prepare the onnx model.
2026-04-19 13:45:40,473 INFO Saving model to: yolov8_cow_original_float_model.onnx.
2026-04-19 13:45:40,474 INFO Start to optimize the onnx model.
2026-04-19 13:45:40,817 INFO End to optimize the onnx model.
2026-04-19 13:45:40,973 INFO Saving model to: yolov8_cow_optimized_float_model.onnx.
2026-04-19 13:45:40,974 INFO Start to calibrate the model.
2026-04-19 13:45:41,061 INFO There are 117 samples in the data set.
2026-04-19 13:45:41,062 INFO Run calibration model with modelwise search method.
2026-04-19 13:45:41,218 INFO Calibration using batch 8
calibration in progress: 100%|██████████████████████████████████████████████████████████| 15/15 [00:57<00:00, 3.82s/it]
2026-04-19 13:46:42,953 INFO Select max-percentile:percentile=0.99995 method.
2026-04-19 13:46:43,474 INFO End to calibrate the model.
2026-04-19 13:46:43,643 INFO Saving model to: yolov8_cow_calibrated_model.onnx.
2026-04-19 13:46:43,645 INFO Start to quantize the model.
2026-04-19 13:46:44,561 INFO End to quantize the model.
2026-04-19 13:46:44,636 INFO Saving model to: yolov8_cow_quantized_model.onnx.
2026-04-19 13:46:44,637 INFO Start to compile the model with march bayes-e.
2026-04-19 13:46:44,945 INFO Compile submodel: main_graph_subgraph_0
2026-04-19 13:46:44,963 INFO hbdk-cc parameters:[‘–O3’, ‘–debug’, ‘–core-num’, ‘1’, ‘–fast’, ‘–input-layout’, ‘NHWC’, ‘–output-layout’, ‘NHWC’, ‘–input-source’, ‘pyramid’]
[==================================================] 100%
2026-04-19 13:47:33,801 INFO consumed time 48.8013
2026-04-19 13:47:33,846 INFO hbir_model has been saved as : main_graph_subgraph_0.hbir
2026-04-19 13:47:33,934 INFO FPS=185.22, latency = 5399.0 us, DDR = 30052672 bytes (see main_graph_subgraph_0.html)
2026-04-19 13:47:34,858 INFO core[0] open!
2026-04-19 13:47:36,786 INFO The consistency check between the quantized model and the hybrid model is passed.
2026-04-19 13:47:36,800 INFO End to compile the model with march bayes-e.
2026-04-19 13:47:36,835 INFO Saving model to: yolov8_cow_hybrid_model.onnx.
2026-04-19 13:47:38,134 INFO The main quantized node information:

Node ON Subgraph Type Cosine Similarity Threshold DataType

HZ_PREPROCESS_FOR_images BPU id(0) HzSQuantizedPreprocess 1.000009 127.0 int8

/model.0/conv/Conv BPU id(0) HzSQuantizedConv 0.999306 1.07178 int8
/model.0/act/Mul BPU id(0) HzLut 0.998523 44.9276 int8
/model.1/conv/Conv BPU id(0) HzSQuantizedConv 0.997315 43.7112 int8
/model.1/act/Mul BPU id(0) HzLut 0.996509 97.4329 int8
/model.2/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.995724 85.8268 int8
/model.2/cv1/act/Mul BPU id(0) HzLut 0.992907 58.9216 int8
/model.2/Split BPU id(0) Split 0.992610 19.3494 int8
/model.2/m.0/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.988938 19.3494 int8
/model.2/m.0/cv1/act/Mul BPU id(0) HzLut 0.987071 28.4779 int8
/model.2/m.0/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.981921 19.8498 int8
/model.2/m.0/cv2/act/Mul BPU id(0) HzLut 0.987032 23.9524 int8
/model.2/m.0/Add BPU id(0) HzSElementwiseAdd 0.991373 19.3494 int8
/model.2/Split_output_0_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.2/Split_output_1_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.2/Concat BPU id(0) Concat 0.991893 19.3494 int8
/model.2/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.992038 19.9787 int8
/model.2/cv2/act/Mul BPU id(0) HzLut 0.990273 20.7856 int8
/model.3/conv/Conv BPU id(0) HzSQuantizedConv 0.991211 9.2066 int8
/model.3/act/Mul BPU id(0) HzLut 0.994285 7.15196 int8
/model.4/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.989004 5.72144 int8
/model.4/cv1/act/Mul BPU id(0) HzLut 0.989424 7.98329 int8
/model.4/Split BPU id(0) Split 0.983615 5.44963 int8
/model.4/m.0/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.991908 5.44963 int8
/model.4/m.0/cv1/act/Mul BPU id(0) HzLut 0.988910 5.61583 int8
/model.4/m.0/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.991004 3.6266 int8
/model.4/m.0/cv2/act/Mul BPU id(0) HzLut 0.991566 6.06252 int8
/model.4/m.0/Add BPU id(0) HzSElementwiseAdd 0.994907 5.44963 int8
/model.4/m.1/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.994576 4.99989 int8
/model.4/m.1/cv1/act/Mul BPU id(0) HzLut 0.988334 5.698 int8
/model.4/m.1/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.991644 2.78232 int8
/model.4/m.1/cv2/act/Mul BPU id(0) HzLut 0.992371 8.10138 int8
/model.4/m.1/Add BPU id(0) HzSElementwiseAdd 0.995535 4.99989 int8
/model.4/Split_output_0_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.4/Split_output_1_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.4/m.0/Add_output_0_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.4/Concat BPU id(0) Concat 0.994123 5.44963 int8
/model.4/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.989767 7.68554 int8
/model.4/cv2/act/Mul BPU id(0) HzLut 0.987519 6.59122 int8
/model.5/conv/Conv BPU id(0) HzSQuantizedConv 0.992515 4.70123 int8
/model.5/act/Mul BPU id(0) HzLut 0.989719 6.38966 int8
/model.6/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.986798 4.37084 int8
/model.6/cv1/act/Mul BPU id(0) HzLut 0.984164 12.3768 int8
/model.6/Split BPU id(0) Split 0.979898 5.71071 int8
/model.6/m.0/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.995449 5.71071 int8
/model.6/m.0/cv1/act/Mul BPU id(0) HzLut 0.987673 7.174 int8
/model.6/m.0/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.993948 5.07718 int8
/model.6/m.0/cv2/act/Mul BPU id(0) HzLut 0.989842 7.42397 int8
/model.6/m.0/Add BPU id(0) HzSElementwiseAdd 0.992242 5.71071 int8
/model.6/m.1/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.996390 4.64337 int8
/model.6/m.1/cv1/act/Mul BPU id(0) HzLut 0.990427 7.07218 int8
/model.6/m.1/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.992205 3.9258 int8
/model.6/m.1/cv2/act/Mul BPU id(0) HzLut 0.991793 9.65781 int8
/model.6/m.1/Add BPU id(0) HzSElementwiseAdd 0.993147 4.64337 int8
/model.6/Split_output_0_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.6/Split_output_1_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.6/m.0/Add_output_0_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.6/Concat BPU id(0) Concat 0.990551 5.71071 int8
/model.6/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.992268 6.77558 int8
/model.6/cv2/act/Mul BPU id(0) HzLut 0.985072 6.14342 int8
/model.7/conv/Conv BPU id(0) HzSQuantizedConv 0.993254 4.11528 int8
/model.7/act/Mul BPU id(0) HzLut 0.982350 7.50737 int8
/model.8/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.989722 4.49329 int8
/model.8/cv1/act/Mul BPU id(0) HzLut 0.980262 8.54441 int8
/model.8/Split BPU id(0) Split 0.978164 6.70584 int8
/model.8/m.0/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.994151 6.70584 int8
/model.8/m.0/cv1/act/Mul BPU id(0) HzLut 0.986955 8.01158 int8
/model.8/m.0/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.990498 5.38623 int8
/model.8/m.0/cv2/act/Mul BPU id(0) HzLut 0.987479 11.455 int8
/model.8/m.0/Add BPU id(0) HzSElementwiseAdd 0.986635 6.70584 int8
/model.8/Split_output_0_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.8/Split_output_1_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.8/Concat BPU id(0) Concat 0.984197 6.70584 int8
/model.8/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.991644 8.30792 int8
/model.8/cv2/act/Mul BPU id(0) HzLut 0.982905 8.37771 int8
/model.9/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.995496 5.30499 int8
/model.9/m/MaxPool BPU id(0) HzQuantizedMaxPool 0.998324 9.13078 int8
/model.9/m_1/MaxPool BPU id(0) HzQuantizedMaxPool 0.998622 9.13078 int8
/model.9/m_2/MaxPool BPU id(0) HzQuantizedMaxPool 0.998724 9.13078 int8
/model.9/Concat BPU id(0) Concat 0.998318 9.13078 int8
/model.9/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.996129 9.13078 int8
/model.9/cv2/act/Mul BPU id(0) HzLut 0.986994 7.95677 int8
/model.10/Resize BPU id(0) HzQuantizedResizeUpsample 0.987031 4.43933 int8
/model.10/Resize_output_0_calibrated_Requantize BPU id(0) HzRequantize – – int8
…el.6/cv2/act/Mul_output_0_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.11/Concat BPU id(0) Concat 0.985606 4.43933 int8
/model.12/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.990595 3.56978 int8
/model.12/cv1/act/Mul BPU id(0) HzLut 0.986324 7.13419 int8
/model.12/Split BPU id(0) Split 0.980583 4.1769 int8
/model.12/m.0/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.993081 4.1769 int8
/model.12/m.0/cv1/act/Mul BPU id(0) HzLut 0.980567 7.40809 int8
/model.12/m.0/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.986908 3.37112 int8
/model.12/m.0/cv2/act/Mul BPU id(0) HzLut 0.983853 7.25208 int8
/model.12/Split_output_0_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.12/Split_output_1_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.12/Concat BPU id(0) Concat 0.985386 4.1769 int8
/model.12/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.988707 4.41829 int8
/model.12/cv2/act/Mul BPU id(0) HzLut 0.983041 6.88971 int8
/model.13/Resize BPU id(0) HzQuantizedResizeUpsample 0.983083 4.81467 int8
/model.13/Resize_output_0_calibrated_Requantize BPU id(0) HzRequantize – – int8
…el.4/cv2/act/Mul_output_0_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.14/Concat BPU id(0) Concat 0.984969 4.81467 int8
/model.15/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.992850 4.14975 int8
/model.15/cv1/act/Mul BPU id(0) HzLut 0.993870 6.30765 int8
/model.15/Split BPU id(0) Split 0.988977 2.93748 int8
/model.15/m.0/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.992879 2.93748 int8
/model.15/m.0/cv1/act/Mul BPU id(0) HzLut 0.990125 5.021 int8
/model.15/m.0/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.989580 2.31791 int8
/model.15/m.0/cv2/act/Mul BPU id(0) HzLut 0.993056 5.5557 int8
/model.15/Split_output_0_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.15/Split_output_1_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.15/Concat BPU id(0) Concat 0.993438 2.93748 int8
/model.15/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.992210 4.46321 int8
/model.15/cv2/act/Mul BPU id(0) HzLut 0.992267 6.09916 int8
/model.16/conv/Conv BPU id(0) HzSQuantizedConv 0.988701 3.92067 int8
/model.16/act/Mul BPU id(0) HzLut 0.982522 6.16259 int8
/model.17/Concat BPU id(0) Concat 0.982861 4.81467 int8
/model.18/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.986413 4.81467 int8
/model.18/cv1/act/Mul BPU id(0) HzLut 0.981293 6.49756 int8
/model.18/Split BPU id(0) Split 0.970992 4.96917 int8
/model.18/m.0/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.990424 4.96917 int8
/model.18/m.0/cv1/act/Mul BPU id(0) HzLut 0.985177 6.37805 int8
/model.18/m.0/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.979504 3.42796 int8
/model.18/m.0/cv2/act/Mul BPU id(0) HzLut 0.975203 10.3212 int8
/model.18/Split_output_0_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.18/Split_output_1_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.18/Concat BPU id(0) Concat 0.977591 4.96917 int8
/model.18/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.987361 7.21077 int8
/model.18/cv2/act/Mul BPU id(0) HzLut 0.983778 9.31555 int8
/model.19/conv/Conv BPU id(0) HzSQuantizedConv 0.987526 4.26326 int8
/model.19/act/Mul BPU id(0) HzLut 0.971063 7.97608 int8
/model.20/Concat BPU id(0) Concat 0.979784 4.43933 int8
/model.21/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.986442 4.43933 int8
/model.21/cv1/act/Mul BPU id(0) HzLut 0.976965 9.6443 int8
/model.21/Split BPU id(0) Split 0.971172 5.49813 int8
/model.21/m.0/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.990244 5.49813 int8
/model.21/m.0/cv1/act/Mul BPU id(0) HzLut 0.975875 8.72303 int8
/model.21/m.0/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.982620 5.67331 int8
/model.21/m.0/cv2/act/Mul BPU id(0) HzLut 0.975880 12.0848 int8
/model.21/Split_output_0_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.21/Split_output_1_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.21/Concat BPU id(0) Concat 0.976020 5.49813 int8
/model.21/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.989450 8.53894 int8
/model.21/cv2/act/Mul BPU id(0) HzLut 0.976016 14.9993 int8
/model.22/cv3.0/cv3.0.0/conv/Conv BPU id(0) HzSQuantizedConv 0.981332 3.92067 int8
/model.22/cv3.0/cv3.0.0/act/Mul BPU id(0) HzLut 0.978545 6.39436 int8
/model.22/cv3.0/cv3.0.1/conv/Conv BPU id(0) HzSQuantizedConv 0.984597 5.5214 int8
/model.22/cv3.0/cv3.0.1/act/Mul BPU id(0) HzLut 0.985793 8.44081 int8
/model.22/cv3.0/cv3.0.2/Conv BPU id(0) HzSQuantizedConv 0.999448 8.37818 int8
/model.22/Transpose CPU – Transpose 0.999448 – float
/model.22/cv2.0/cv2.0.0/conv/Conv BPU id(0) HzSQuantizedConv 0.988758 3.92067 int8
/model.22/cv2.0/cv2.0.0/act/Mul BPU id(0) HzLut 0.984308 8.49597 int8
/model.22/cv2.0/cv2.0.1/conv/Conv BPU id(0) HzSQuantizedConv 0.986237 5.26952 int8
/model.22/cv2.0/cv2.0.1/act/Mul BPU id(0) HzLut 0.986819 20.0159 int8
/model.22/cv2.0/cv2.0.2/Conv BPU id(0) HzSQuantizedConv 0.990909 19.4194 int8
/model.22/Transpose_1 CPU – Transpose 0.990909 – float
/model.22/cv3.1/cv3.1.0/conv/Conv BPU id(0) HzSQuantizedConv 0.976600 4.26326 int8
/model.22/cv3.1/cv3.1.0/act/Mul BPU id(0) HzLut 0.976541 8.45732 int8
/model.22/cv3.1/cv3.1.1/conv/Conv BPU id(0) HzSQuantizedConv 0.983007 7.62087 int8
/model.22/cv3.1/cv3.1.1/act/Mul BPU id(0) HzLut 0.983587 14.3788 int8
/model.22/cv3.1/cv3.1.2/Conv BPU id(0) HzSQuantizedConv 0.999004 14.0453 int8
/model.22/Transpose_2 CPU – Transpose 0.999004 – float
/model.22/cv2.1/cv2.1.0/conv/Conv BPU id(0) HzSQuantizedConv 0.983575 4.26326 int8
/model.22/cv2.1/cv2.1.0/act/Mul BPU id(0) HzLut 0.983002 14.1845 int8
/model.22/cv2.1/cv2.1.1/conv/Conv BPU id(0) HzSQuantizedConv 0.988803 7.72667 int8
/model.22/cv2.1/cv2.1.1/act/Mul BPU id(0) HzLut 0.988968 22.3114 int8
/model.22/cv2.1/cv2.1.2/Conv BPU id(0) HzSQuantizedConv 0.992698 22.1627 int8
/model.22/Transpose_3 CPU – Transpose 0.992697 – float
/model.22/cv3.2/cv3.2.0/conv/Conv BPU id(0) HzSQuantizedConv 0.982606 5.28644 int8
/model.22/cv3.2/cv3.2.0/act/Mul BPU id(0) HzLut 0.979600 10.3133 int8
/model.22/cv3.2/cv3.2.1/conv/Conv BPU id(0) HzSQuantizedConv 0.983940 9.61694 int8
/model.22/cv3.2/cv3.2.1/act/Mul BPU id(0) HzLut 0.985166 17.8943 int8
/model.22/cv3.2/cv3.2.2/Conv BPU id(0) HzSQuantizedConv 0.997589 17.6595 int8
/model.22/Transpose_4 CPU – Transpose 0.997589 – float
/model.22/cv2.2/cv2.2.0/conv/Conv BPU id(0) HzSQuantizedConv 0.989705 5.28644 int8
/model.22/cv2.2/cv2.2.0/act/Mul BPU id(0) HzLut 0.986526 11.5501 int8
/model.22/cv2.2/cv2.2.1/conv/Conv BPU id(0) HzSQuantizedConv 0.990666 9.45998 int8
/model.22/cv2.2/cv2.2.1/act/Mul BPU id(0) HzLut 0.991346 20.9386 int8
/model.22/cv2.2/cv2.2.2/Conv BPU id(0) HzSQuantizedConv 0.995579 20.7491 int8
/model.22/Transpose_5 CPU – Transpose 0.995579 – float
2026-04-19 13:47:38,137 INFO The quantized model output:

Output Cosine Similarity L1 Distance L2 Distance Chebyshev Distance

output0 0.999448 0.492888 0.003710 5.550701
324 0.990909 0.389095 0.000876 5.726426
332 0.999004 0.564130 0.009112 7.719759
340 0.992697 0.374265 0.001711 4.801188
348 0.997589 0.781466 0.028093 10.940637
356 0.995579 0.284901 0.002612 3.704115
/model.22/cv2.1/cv2.1.2/Conv_output_0 0.992698 0.374265 0.001711 4.801188
/model.9/cv1/conv/Conv_output_0_calibrated 0.995496 0.124000 0.000741 1.093799
/model.16/conv/Conv_output_0_calibrated 0.988701 0.138482 0.000586 2.033508
/model.22/cv2.2/cv2.2.2/Conv_output_0 0.995579 0.284901 0.002612 3.704115
/model.1/conv/Conv_output_0_calibrated 0.997315 0.422460 0.000632 17.888557
/model.4/m.0/cv2/conv/Conv_output_0_calibrated 0.991004 0.122926 0.000369 2.342625
/model.18/cv1/conv/Conv_output_0_calibrated 0.986413 0.153137 0.000460 2.346108
/model.4/m.1/cv2/conv/Conv_output_0_calibrated 0.991644 0.168169 0.000495 2.314514
/model.4/m.1/cv1/conv/Conv_output_0_calibrated 0.994576 0.115666 0.000336 1.452027
/model.5/conv/Conv_output_0_calibrated 0.992515 0.119547 0.000360 1.714721
…22/cv3.1/cv3.1.1/conv/Conv_output_0_calibrated 0.983007 0.170171 0.000772 4.700251
/model.22/cv2.0/cv2.0.2/Conv_output_0 0.990909 0.389095 0.000876 5.726426
/model.4/cv2/conv/Conv_output_0_calibrated 0.989767 0.127648 0.000272 1.948580
/model.21/m.0/cv1/conv/Conv_output_0_calibrated 0.990244 0.164896 0.001032 2.578416
/model.12/cv1/conv/Conv_output_0_calibrated 0.990595 0.151944 0.000453 1.880934
/model.2/cv1/conv/Conv_output_0_calibrated 0.995724 0.259917 0.000409 15.297455
/model.0/conv/Conv_output_0_calibrated 0.999306 0.112691 0.000118 4.035484
/model.2/m.0/cv1/conv/Conv_output_0_calibrated 0.988938 0.428464 0.000873 6.779032
/model.6/m.0/cv1/conv/Conv_output_0_calibrated 0.995449 0.128251 0.000529 1.468667
/model.18/m.0/cv1/conv/Conv_output_0_calibrated 0.990424 0.131262 0.000562 1.769343
…22/cv3.1/cv3.1.0/conv/Conv_output_0_calibrated 0.976600 0.160925 0.000734 4.337944
/model.21/m.0/cv2/conv/Conv_output_0_calibrated 0.982620 0.209325 0.001323 3.078192
…22/cv2.1/cv2.1.0/conv/Conv_output_0_calibrated 0.983575 0.190600 0.000922 6.573485
/model.6/cv1/conv/Conv_output_0_calibrated 0.986798 0.147393 0.000512 4.453465
/model.22/cv3.1/cv3.1.2/Conv_output_0 0.999004 0.564130 0.009112 7.719759
/model.12/m.0/cv2/conv/Conv_output_0_calibrated 0.986908 0.144497 0.000613 2.159184
/model.9/cv2/conv/Conv_output_0_calibrated 0.996129 0.124609 0.000515 1.061943
…22/cv2.2/cv2.2.1/conv/Conv_output_0_calibrated 0.990666 0.250467 0.002387 3.593115
/model.18/m.0/cv2/conv/Conv_output_0_calibrated 0.979504 0.208189 0.000933 9.430080
/model.6/m.1/cv1/conv/Conv_output_0_calibrated 0.996390 0.109324 0.000453 1.054392
/model.15/cv2/conv/Conv_output_0_calibrated 0.992210 0.105636 0.000240 2.264639
…22/cv2.0/cv2.0.0/conv/Conv_output_0_calibrated 0.988758 0.142338 0.000310 2.524422
/model.21/cv2/conv/Conv_output_0_calibrated 0.989450 0.159946 0.000728 3.083925
/model.6/m.0/cv2/conv/Conv_output_0_calibrated 0.993948 0.098657 0.000419 1.644034
/model.2/cv2/conv/Conv_output_0_calibrated 0.992038 0.202271 0.000305 4.776224
/model.2/m.0/cv2/conv/Conv_output_0_calibrated 0.981921 0.482070 0.001050 8.163872
/model.15/cv1/conv/Conv_output_0_calibrated 0.992850 0.103285 0.000227 1.617227
/model.12/m.0/cv1/conv/Conv_output_0_calibrated 0.993081 0.135487 0.000561 1.500420
/model.6/m.1/cv2/conv/Conv_output_0_calibrated 0.992205 0.150869 0.000641 1.880284
/model.6/cv2/conv/Conv_output_0_calibrated 0.992268 0.122963 0.000371 1.901886
/model.18/cv2/conv/Conv_output_0_calibrated 0.987361 0.131353 0.000438 4.079590
/model.12/cv2/conv/Conv_output_0_calibrated 0.988707 0.134350 0.000406 4.422950
…22/cv3.2/cv3.2.1/conv/Conv_output_0_calibrated 0.983940 0.174141 0.001610 4.139734
…22/cv3.0/cv3.0.1/conv/Conv_output_0_calibrated 0.984597 0.194169 0.000409 2.694091
/model.4/m.0/cv1/conv/Conv_output_0_calibrated 0.991908 0.119743 0.000352 1.274290
/model.8/cv1/conv/Conv_output_0_calibrated 0.989722 0.164648 0.000726 2.283880
/model.19/conv/Conv_output_0_calibrated 0.987526 0.129650 0.000843 2.476458
…22/cv2.1/cv2.1.1/conv/Conv_output_0_calibrated 0.988803 0.288123 0.001399 7.793471
/model.4/cv1/conv/Conv_output_0_calibrated 0.989004 0.138659 0.000313 4.213844
/model.15/m.0/cv2/conv/Conv_output_0_calibrated 0.989580 0.128059 0.000385 2.978722
…22/cv3.2/cv3.2.0/conv/Conv_output_0_calibrated 0.982606 0.139985 0.001240 2.911432
/model.7/conv/Conv_output_0_calibrated 0.993254 0.134444 0.000565 1.425202
…22/cv3.0/cv3.0.0/conv/Conv_output_0_calibrated 0.981332 0.174401 0.000360 2.126180
/model.22/cv3.0/cv3.0.2/Conv_output_0 0.999448 0.492888 0.003710 5.550701
/model.3/conv/Conv_output_0_calibrated 0.991211 0.149960 0.000316 2.181579
…22/cv2.2/cv2.2.0/conv/Conv_output_0_calibrated 0.989705 0.173552 0.001552 2.350510
…22/cv2.0/cv2.0.1/conv/Conv_output_0_calibrated 0.986237 0.350213 0.000808 6.315136
/model.8/m.0/cv2/conv/Conv_output_0_calibrated 0.990498 0.208450 0.001230 1.857572
/model.22/cv3.2/cv3.2.2/Conv_output_0 0.997589 0.781466 0.028093 10.940637
/model.15/m.0/cv1/conv/Conv_output_0_calibrated 0.992879 0.108859 0.000317 1.131733
/model.8/m.0/cv1/conv/Conv_output_0_calibrated 0.994151 0.152295 0.000904 1.609603
/model.8/cv2/conv/Conv_output_0_calibrated 0.991644 0.160085 0.000675 1.577124
/model.21/cv1/conv/Conv_output_0_calibrated 0.986442 0.166829 0.000756 3.717987
2026-04-19 13:47:38,154 INFO End to Horizon NN Model Convert.
2026-04-19 13:47:38,195 INFO start convert to *.bin file…
2026-04-19 13:47:38,215 INFO ONNX model output num : 69
2026-04-19 13:47:38,222 INFO ############# model deps info #############
2026-04-19 13:47:38,223 INFO hb_mapper version : 1.24.3
2026-04-19 13:47:38,224 INFO hbdk version : 3.49.15
2026-04-19 13:47:38,225 INFO hbdk runtime version: 3.15.55.0
2026-04-19 13:47:38,227 INFO horizon_nn version : 1.1.0
2026-04-19 13:47:38,228 INFO ############# model_parameters info #############
2026-04-19 13:47:38,230 INFO onnx_model : /data/best.onnx
2026-04-19 13:47:38,231 INFO BPU march : bayes-e
2026-04-19 13:47:38,232 INFO layer_out_dump : True
2026-04-19 13:47:38,233 INFO log_level : DEBUG
2026-04-19 13:47:38,234 INFO working dir : /data/model_output
2026-04-19 13:47:38,236 INFO output_model_file_prefix: yolov8_cow
2026-04-19 13:47:38,237 INFO ############# input_parameters info #############
2026-04-19 13:47:38,238 INFO ------------------------------------------
2026-04-19 13:47:38,239 INFO ---------input info : images ---------
2026-04-19 13:47:38,241 INFO input_name : images
2026-04-19 13:47:38,242 INFO input_type_rt : nv12
2026-04-19 13:47:38,243 INFO input_space&range : regular
2026-04-19 13:47:38,245 INFO input_layout_rt : None
2026-04-19 13:47:38,246 INFO input_type_train : rgb
2026-04-19 13:47:38,248 INFO input_layout_train : NCHW
2026-04-19 13:47:38,249 INFO norm_type : data_scale
2026-04-19 13:47:38,250 INFO input_shape : 1x3x640x640
2026-04-19 13:47:38,251 INFO scale_value : 0.003921568627451,
2026-04-19 13:47:38,253 INFO cal_data_dir : /data/cal_bin
2026-04-19 13:47:38,254 INFO cal_data_type : float32
2026-04-19 13:47:38,256 INFO ---------input info : images end -------
2026-04-19 13:47:38,257 INFO ------------------------------------------
2026-04-19 13:47:38,258 INFO ############# calibration_parameters info #############
2026-04-19 13:47:38,259 INFO preprocess_on : False
2026-04-19 13:47:38,261 INFO calibration_type: : default
2026-04-19 13:47:38,262 INFO per_channel : False
2026-04-19 13:47:38,263 INFO ############# compiler_parameters info #############
2026-04-19 13:47:38,264 INFO debug : True
2026-04-19 13:47:38,266 INFO compile_mode : latency
2026-04-19 13:47:38,267 INFO hbdk_pass_through_params: --O3 --debug --core-num 1 --fast
2026-04-19 13:47:38,269 INFO input-source : {‘images’: ‘pyramid’, ‘_default_value’: ‘ddr’}
2026-04-19 13:47:38,320 INFO Convert to runtime bin file successfully!
2026-04-19 13:47:38,322 INFO End Model Convert,

然后在板子上运行tros发现还是具有很多层数,日志如下:

root@ubuntu:/home/sunrise/yolov8# ros2 launch dnn_node_example dnn_node_example_feedback.launch.py dnn_example_config_file:=my_config/yolov8workconfig.json dnn_example_image:=my_config/target.jpg
[INFO] [launch]: All log files can be found below /root/.ros/log/2026-04-19-13-50-11-605652-ubuntu-80979
[INFO] [launch]: Default logging verbosity is set to INFO
dnn_node_example_path is /opt/tros/humble/lib/dnn_node_example
cp_cmd is cp -r /opt/tros/humble/lib/dnn_node_example/config .
[INFO] [example-1]: process started with pid [80989]
[example-1] [WARN] [1776577812.207180231] [dnn_example_node]: Parameter:
[example-1] feed_type(0:local, 1:sub): 0
[example-1] image: my_config/target.jpg
[example-1] image_type: 0
[example-1] dump_render_img: 1
[example-1] is_shared_mem_sub: 0
[example-1] config_file: my_config/yolov8workconfig.json
[example-1] msg_pub_topic_name: hobot_dnn_detection
[example-1] info_msg_pub_topic_name: hobot_dnn_detection_info
[example-1] ros_img_topic_name: /image
[example-1] sharedmem_img_topic_name: /hbmem_img
[example-1] [WARN] [1776577812.207804440] [dnn_example_node]: Load [5] class types from file [my_config/cow.list]
[example-1] [WARN] [1776577812.207928815] [dnn_example_node]: Parameter:
[example-1] model_file_name: /home/sunrise/yolov8/cow7.bin
[example-1] model_name:
[example-1] [INFO] [1776577812.208012232] [dnn]: Node init.
[example-1] [INFO] [1776577812.208036065] [dnn_example_node]: Set node para.
[example-1] [WARN] [1776577812.208075274] [dnn_example_node]: model_file_name_: /home/sunrise/yolov8/cow7.bin, task_num: 4
[example-1] [INFO] [1776577812.208121816] [dnn]: Model init.
[example-1] [BPU_PLAT]BPU Platform Version(1.3.6)! soc info(x5)
[example-1] [HBRT] set log level as 0. version = 3.15.55.0
[example-1] [DNN] Runtime version = 1.24.5_(3.15.55 HBRT)
[example-1] [A][DNN][packed_model.cpp:247]Model [HorizonRT] The model builder version = 1.24.3
[example-1] [INFO] [1776577812.423811805] [dnn]: The model input 0 width is 640 and height is 640
[example-1] [INFO] [1776577812.424540306] [dnn]:
[example-1] Model Info:
[example-1] name: yolov8_cow.
[example-1] [input]
[example-1] - (0) Layout: NCHW, Shape: [1, 3, 640, 640], Type: HB_DNN_IMG_TYPE_NV12.
[example-1] [output]
[example-1] - (0) Layout: NHWC, Shape: [1, 80, 80, 5], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (1) Layout: NHWC, Shape: [1, 80, 80, 64], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (2) Layout: NHWC, Shape: [1, 40, 40, 5], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (3) Layout: NHWC, Shape: [1, 40, 40, 64], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (4) Layout: NHWC, Shape: [1, 20, 20, 5], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (5) Layout: NHWC, Shape: [1, 20, 20, 64], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (6) Layout: NCHW, Shape: [1, 64, 40, 40], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (7) Layout: NCHW, Shape: [1, 128, 20, 20], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (8) Layout: NCHW, Shape: [1, 64, 40, 40], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (9) Layout: NCHW, Shape: [1, 64, 20, 20], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (10) Layout: NCHW, Shape: [1, 32, 160, 160], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (11) Layout: NCHW, Shape: [1, 32, 80, 80], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (12) Layout: NCHW, Shape: [1, 128, 40, 40], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (13) Layout: NCHW, Shape: [1, 32, 80, 80], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (14) Layout: NCHW, Shape: [1, 32, 80, 80], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (15) Layout: NCHW, Shape: [1, 128, 40, 40], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (16) Layout: NCHW, Shape: [1, 64, 40, 40], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (17) Layout: NCHW, Shape: [1, 64, 80, 80], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (18) Layout: NCHW, Shape: [1, 64, 80, 80], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (19) Layout: NCHW, Shape: [1, 128, 20, 20], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (20) Layout: NCHW, Shape: [1, 128, 40, 40], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (21) Layout: NCHW, Shape: [1, 32, 160, 160], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (22) Layout: NCHW, Shape: [1, 16, 320, 320], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (23) Layout: NCHW, Shape: [1, 16, 160, 160], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (24) Layout: NCHW, Shape: [1, 64, 40, 40], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (25) Layout: NCHW, Shape: [1, 64, 40, 40], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (26) Layout: NCHW, Shape: [1, 64, 40, 40], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (27) Layout: NCHW, Shape: [1, 128, 20, 20], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (28) Layout: NCHW, Shape: [1, 64, 40, 40], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (29) Layout: NCHW, Shape: [1, 128, 40, 40], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (30) Layout: NCHW, Shape: [1, 5, 40, 40], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (31) Layout: NCHW, Shape: [1, 64, 40, 40], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (32) Layout: NCHW, Shape: [1, 256, 20, 20], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (33) Layout: NCHW, Shape: [1, 64, 20, 20], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (34) Layout: NCHW, Shape: [1, 64, 40, 40], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (35) Layout: NCHW, Shape: [1, 64, 40, 40], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (36) Layout: NCHW, Shape: [1, 64, 80, 80], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (37) Layout: NCHW, Shape: [1, 64, 80, 80], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (38) Layout: NCHW, Shape: [1, 256, 20, 20], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (39) Layout: NCHW, Shape: [1, 64, 40, 40], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (40) Layout: NCHW, Shape: [1, 32, 160, 160], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (41) Layout: NCHW, Shape: [1, 16, 160, 160], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (42) Layout: NCHW, Shape: [1, 64, 80, 80], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (43) Layout: NCHW, Shape: [1, 64, 40, 40], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (44) Layout: NCHW, Shape: [1, 64, 40, 40], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (45) Layout: NCHW, Shape: [1, 128, 40, 40], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (46) Layout: NCHW, Shape: [1, 128, 40, 40], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (47) Layout: NCHW, Shape: [1, 128, 40, 40], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (48) Layout: NCHW, Shape: [1, 64, 20, 20], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (49) Layout: NCHW, Shape: [1, 64, 80, 80], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (50) Layout: NCHW, Shape: [1, 32, 80, 80], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (51) Layout: NCHW, Shape: [1, 256, 20, 20], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (52) Layout: NCHW, Shape: [1, 128, 20, 20], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (53) Layout: NCHW, Shape: [1, 64, 40, 40], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (54) Layout: NCHW, Shape: [1, 64, 80, 80], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (55) Layout: NCHW, Shape: [1, 32, 80, 80], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (56) Layout: NCHW, Shape: [1, 64, 20, 20], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (57) Layout: NCHW, Shape: [1, 256, 20, 20], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (58) Layout: NCHW, Shape: [1, 64, 80, 80], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (59) Layout: NCHW, Shape: [1, 5, 80, 80], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (60) Layout: NCHW, Shape: [1, 64, 80, 80], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (61) Layout: NCHW, Shape: [1, 64, 20, 20], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (62) Layout: NCHW, Shape: [1, 64, 80, 80], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (63) Layout: NCHW, Shape: [1, 128, 20, 20], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (64) Layout: NCHW, Shape: [1, 5, 20, 20], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (65) Layout: NCHW, Shape: [1, 32, 80, 80], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (66) Layout: NCHW, Shape: [1, 128, 20, 20], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (67) Layout: NCHW, Shape: [1, 256, 20, 20], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (68) Layout: NCHW, Shape: [1, 256, 20, 20], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1]
[example-1] [INFO] [1776577812.425009557] [dnn]: Task init.
[example-1] [INFO] [1776577812.426805101] [dnn]: Set task_num [4]
[example-1] [WARN] [1776577812.426895643] [dnn_example_node]: Get model name: yolov8_cow from load model.
[example-1] [INFO] [1776577812.427025143] [dnn_example_node]: The model input width is 640 and height is 640
[example-1] [WARN] [1776577812.427141769] [dnn_example_node]: Create ai msg publisher with topic_name: hobot_dnn_detection
[example-1] [INFO] [1776577812.440029080] [dnn_example_node]: Dnn node feed with local image: my_config/target.jpg
[example-1] [INFO] [1776577812.551415163] [dnn_example_node]: Output from frame_id: feedback, stamp: 0.0
[example-1] [ERROR] [1776577812.551661205] [dnn_example_node]: Inlvaid parser: 0
^C[WARNING] [launch]: user interrupted with ctrl-c (SIGINT)
[example-1] [INFO] [1776577825.965794570] [rclcpp]: signal_handler(signum=2)
[INFO] [example-1]: process has finished cleanly [pid 80989]

我怀疑是yaml文件编写有问题,附上我按照方案一的yaml文件

model_parameters:
onnx_model: ‘./best.onnx’
march: “bayes-e”
layer_out_dump: True
working_dir: ‘model_output’
output_model_file_prefix: ‘yolov8_cow’

input_parameters:
input_name: “images”
input_type_rt: ‘nv12’
input_type_train: ‘rgb’
input_layout_train: ‘NCHW’
norm_type: ‘data_scale’
scale_value: 0.003921568627451

calibration_parameters:
cal_data_dir: ‘./cal_bin’
cal_data_type: ‘float32’
calibration_type: ‘default’

compiler_parameters:
compile_mode: ‘latency’
debug: True
optimize_level: ‘O3’

你好!问题已经非常清晰了,我找到了根本原因!

核心问题定位

你的模型有 69 个输出,但 TROS 的 YOLOv8 parser 期望只有 6 个输出(3 个 cls + 3 个 bbox)。

原因:你在 YAML 中设置了 layer_out_dump: True,这会导致模型输出所有中间层的激活值,而不仅仅是最终的检测头输出。


解决方案

步骤 1:修正 YAML 配置

关键修改:

  • layer_out_dump: False(关闭调试输出)
  • debug: False(关闭编译器调试)
model_parameters:
  onnx_model: './best.onnx'
  march: "bayes-e"
  layer_out_dump: False  # 关键:必须为 False!
  working_dir: 'model_output'
  output_model_file_prefix: 'yolov8_cow'

input_parameters:
  input_name: "images"
  input_type_rt: 'nv12'
  input_type_train: 'rgb'
  input_layout_train: 'NCHW'
  norm_type: 'data_scale'
  scale_value: 0.003921568627451

calibration_parameters:
  cal_data_dir: './cal_bin'
  cal_data_type: 'float32'
  calibration_type: 'default'

compiler_parameters:
  compile_mode: 'latency'
  debug: False  # 关闭调试
  optimize_level: 'O3'

步骤 2:使用正确的 ONNX 导出脚本

使用你提供的 export_yolo26_detect_bpu.py(方案二的脚本),这个脚本是正确的:

def bpu_detect_forward(self, x):
    result = []
    for i in range(self.nl):
        # bbox 分支:保持 float32,不要转 int32!
        bbox = self.cv2[i](x[i])  # (B, 4*reg_max, H, W)
        
        # cls 分支:保持 float32
        cls = self.cv3[i](x[i])  # (B, nc, H, W)
        
        # 关键:先 permute 再调整顺序
        # 1. NCHW -> NHWC
        bbox = bbox.permute(0, 2, 3, 1).contiguous()  # (B, H, W, 4*reg_max)
        cls = cls.permute(0, 2, 3, 1).contiguous()    # (B, H, W, nc)
        
        # 2. 输出顺序:先 cls 后 bbox(匹配官方)
        result.append(cls)
        result.append(bbox)
    return result

重新导出 ONNX:

python export_yolo26_detect_bpu.py --weights your_model.pt --imgsz 640

步骤 3:重新编译模型

hb_mapper makertbin --model-type onnx --config yolov8.yaml

步骤 4:验证模型输出

编译完成后,检查模型输出:

hrt_model_exec model_info --model_file=./model_output/yolov8_cow.bin

期望输出(应该只有 6 个输出):

This model file has 1 model:
[yolov8_cow]

input[0]:
  name: images
  ...

output[0]:
  valid shape: (1,80,80,5,)
  tensor type: HB_DNN_TENSOR_TYPE_F32
  tensor layout: HB_DNN_LAYOUT_NHWC

output[1]:
  valid shape: (1,80,80,64,)
  tensor type: HB_DNN_TENSOR_TYPE_S32
  tensor layout: HB_DNN_LAYOUT_NHWC

output[2]:
  valid shape: (1,40,40,5,)
  tensor type: HB_DNN_TENSOR_TYPE_F32
  tensor layout: HB_DNN_LAYOUT_NHWC

output[3]:
  valid shape: (1,40,40,64,)
  tensor type: HB_DNN_TENSOR_TYPE_S32
  tensor layout: HB_DNN_LAYOUT_NHWC

output[4]:
  valid shape: (1,20,20,5,)
  tensor type: HB_DNN_TENSOR_TYPE_F32
  tensor layout: HB_DNN_LAYOUT_NHWC

output[5]:
  valid shape: (1,20,20,64,)
  tensor type: HB_DNN_TENSOR_TYPE_S32
  tensor layout: HB_DNN_LAYOUT_NHWC

关键点:

  • :white_check_mark: 只有 6 个输出(不是 69 个)
  • :white_check_mark: bbox 分支是 S32(output[1], [3], [5])
  • :white_check_mark: cls 分支是 F32(output[0], [2], [4])
  • :white_check_mark: 所有输出 layout 都是 NHWC

步骤 5:运行 TROS 测试

ros2 launch dnn_node_example dnn_node_example_feedback.launch.py \
  dnn_example_config_file:=my_config/yolov8workconfig.json \
  dnn_example_image:=my_config/target.jpg

问题总结

问题 原因 解决方案
69 个输出 layer_out_dump: True 改为 False
Invalid parser: 0 输出数量不匹配 确保只有 6 个输出
bbox layout 为 NONE 编译器调试模式影响 关闭 debug: False
quanti type 为 NONE hb_mapper 自动处理 不需要手动配置

快速验证命令

# 1. 检查输出数量
hrt_model_exec model_info --model_file=./cow.bin | grep "output\[" | wc -l
# 期望:6

# 2. 检查 bbox 类型
hrt_model_exec model_info --model_file=./cow.bin | grep -A5 "output\[1\]"
# 期望:S32 + NHWC

先按上述步骤重新编译,然后把新的 hrt_model_exec model_info 输出发出来,应该就能看到只有 6 个输出了!

你好!我按照您的操作步骤进行后,还是Inlvaid parser: 0报错,我分别附上hb_mapper的日志:

oot@46a86a8809fe:/data# hb_mapper makertbin --model-type onnx --config yolov8.yaml

2026-04-19 13:55:50,080 INFO log will be stored in /data/hb_mapper_makertbin.log
2026-04-19 13:55:50,081 INFO Start hb_mapper…
2026-04-19 13:55:50,082 INFO hbdk version 3.49.15
2026-04-19 13:55:50,084 INFO horizon_nn version 1.1.0
2026-04-19 13:55:50,085 INFO hb_mapper version 1.24.3
2026-04-19 13:55:50,086 INFO Start Model Convert…
2026-04-19 13:55:50,092 INFO Using onnx model file: /data/best.onnx
2026-04-19 13:55:50,167 INFO Model has 1 inputs according to model file
2026-04-19 13:55:50,170 INFO Model input shape not given in yaml_file, using shape from model file: [[1, 3, 640, 640]]
2026-04-19 13:55:50,171 INFO nv12 input type rt received.
2026-04-19 13:55:50,174 WARNING The calibration dir name suffix is not the same as the value float32 of the parameter cal_data_type, the parameter setting will prevail
2026-04-19 13:55:50,175 INFO custom_op does not exist, skipped
2026-04-19 13:55:50,176 WARNING Input node images’s input_source not set, it will be set to pyramid by default
2026-04-19 13:55:50,186 INFO *******************************************
2026-04-19 13:55:50,187 INFO First calibration picture name: 000d64dae0250e8b.bin
2026-04-19 13:55:50,188 INFO First calibration picture md5:
056d797381f1224d368ed8c3fc8c71db /data/cal_bin/000d64dae0250e8b.bin
2026-04-19 13:55:50,229 INFO *******************************************
2026-04-19 13:55:59,387 INFO Start to Horizon NN Model Convert.
2026-04-19 13:55:59,472 INFO Loading horizon_nn debug methods:set()
2026-04-19 13:55:59,474 INFO The activation calibration parameters:
calibration_type: [‘max’, ‘kl’]
max_percentile: [0.99995, 1.0]
per_channel: [True, False]
asymmetric: [True, False]
The modelwise search parameters:
similarity: 0.995
metric: cosine-similarity
2026-04-19 13:55:59,475 INFO input images is from pyramid. Its layout is set to NHWC
2026-04-19 13:55:59,476 INFO The specified model compilation architecture: bayes-e.
2026-04-19 13:55:59,477 INFO The specified model compilation optimization parameters: .
2026-04-19 13:55:59,477 INFO Start to prepare the onnx model.
2026-04-19 13:55:59,490 INFO Input ONNX Model Information:
ONNX IR version: 6
Opset version: [‘ai.onnx v11’, ‘horizon v1’]
Producer: pytorch v2.10.0
Domain: None
Version: None
Graph input:
images: shape=[1, 3, 640, 640], dtype=FLOAT32
Graph output:
output0: shape=[1, 80, 80, 5], dtype=FLOAT32
323: shape=[1, 80, 80, 64], dtype=FLOAT32
340: shape=[1, 40, 40, 5], dtype=FLOAT32
339: shape=[1, 40, 40, 64], dtype=FLOAT32
356: shape=[1, 20, 20, 5], dtype=FLOAT32
355: shape=[1, 20, 20, 64], dtype=FLOAT32
2026-04-19 13:55:59,675 INFO End to prepare the onnx model.
2026-04-19 13:55:59,845 INFO Saving model to: yolov8_cow_original_float_model.onnx.
2026-04-19 13:55:59,847 INFO Start to optimize the onnx model.
2026-04-19 13:56:00,119 INFO End to optimize the onnx model.
2026-04-19 13:56:00,387 INFO Saving model to: yolov8_cow_optimized_float_model.onnx.
2026-04-19 13:56:00,389 INFO Start to calibrate the model.
2026-04-19 13:56:00,474 INFO There are 117 samples in the data set.
2026-04-19 13:56:00,476 INFO Run calibration model with modelwise search method.
2026-04-19 13:56:00,625 INFO Calibration using batch 8
calibration in progress: 100%|██████████████████████████████████████████████████████████| 15/15 [00:57<00:00, 3.81s/it]
2026-04-19 13:57:02,128 INFO Select max-percentile:percentile=0.99995 method.
2026-04-19 13:57:02,465 INFO End to calibrate the model.
2026-04-19 13:57:02,637 INFO Saving model to: yolov8_cow_calibrated_model.onnx.
2026-04-19 13:57:02,638 INFO Start to quantize the model.
2026-04-19 13:57:03,443 INFO End to quantize the model.
2026-04-19 13:57:03,496 INFO Saving model to: yolov8_cow_quantized_model.onnx.
2026-04-19 13:57:03,497 INFO Start to compile the model with march bayes-e.
2026-04-19 13:57:03,678 INFO Compile submodel: main_graph_subgraph_0
2026-04-19 13:57:03,692 INFO hbdk-cc parameters:[‘–O3’, ‘–core-num’, ‘1’, ‘–fast’, ‘–input-layout’, ‘NHWC’, ‘–output-layout’, ‘NHWC’, ‘–input-source’, ‘pyramid’]
[==================================================] 100%
2026-04-19 13:58:02,732 INFO consumed time 59.0217
2026-04-19 13:58:02,822 INFO FPS=277.63, latency = 3601.9 us, DDR = 9586752 bytes (see main_graph_subgraph_0.html)
2026-04-19 13:58:02,878 INFO End to compile the model with march bayes-e.
2026-04-19 13:58:04,173 INFO The main quantized node information:

Node ON Subgraph Type Cosine Similarity Threshold DataType

HZ_PREPROCESS_FOR_images BPU id(0) HzSQuantizedPreprocess 1.000009 127.0 int8

/model.0/conv/Conv BPU id(0) HzSQuantizedConv 0.999306 1.07178 int8
/model.0/act/Mul BPU id(0) HzLut 0.998523 44.9276 int8
/model.1/conv/Conv BPU id(0) HzSQuantizedConv 0.997315 43.7112 int8
/model.1/act/Mul BPU id(0) HzLut 0.996509 97.4329 int8
/model.2/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.995724 85.8268 int8
/model.2/cv1/act/Mul BPU id(0) HzLut 0.992907 58.9216 int8
/model.2/Split BPU id(0) Split 0.992610 19.3494 int8
/model.2/m.0/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.988938 19.3494 int8
/model.2/m.0/cv1/act/Mul BPU id(0) HzLut 0.987071 28.4779 int8
/model.2/m.0/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.981921 19.8498 int8
/model.2/m.0/cv2/act/Mul BPU id(0) HzLut 0.987032 23.9524 int8
/model.2/m.0/Add BPU id(0) HzSElementwiseAdd 0.991373 19.3494 int8
/model.2/Split_output_0_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.2/Split_output_1_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.2/Concat BPU id(0) Concat 0.991893 19.3494 int8
/model.2/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.992038 19.9787 int8
/model.2/cv2/act/Mul BPU id(0) HzLut 0.990273 20.7856 int8
/model.3/conv/Conv BPU id(0) HzSQuantizedConv 0.991211 9.2066 int8
/model.3/act/Mul BPU id(0) HzLut 0.994285 7.15196 int8
/model.4/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.989004 5.72144 int8
/model.4/cv1/act/Mul BPU id(0) HzLut 0.989424 7.98329 int8
/model.4/Split BPU id(0) Split 0.983615 5.44963 int8
/model.4/m.0/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.991908 5.44963 int8
/model.4/m.0/cv1/act/Mul BPU id(0) HzLut 0.988910 5.61583 int8
/model.4/m.0/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.991004 3.6266 int8
/model.4/m.0/cv2/act/Mul BPU id(0) HzLut 0.991566 6.06252 int8
/model.4/m.0/Add BPU id(0) HzSElementwiseAdd 0.994907 5.44963 int8
/model.4/m.1/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.994576 4.99989 int8
/model.4/m.1/cv1/act/Mul BPU id(0) HzLut 0.988334 5.698 int8
/model.4/m.1/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.991644 2.78232 int8
/model.4/m.1/cv2/act/Mul BPU id(0) HzLut 0.992371 8.10138 int8
/model.4/m.1/Add BPU id(0) HzSElementwiseAdd 0.995535 4.99989 int8
/model.4/Split_output_0_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.4/Split_output_1_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.4/m.0/Add_output_0_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.4/Concat BPU id(0) Concat 0.994123 5.44963 int8
/model.4/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.989767 7.68554 int8
/model.4/cv2/act/Mul BPU id(0) HzLut 0.987519 6.59122 int8
/model.5/conv/Conv BPU id(0) HzSQuantizedConv 0.992515 4.70123 int8
/model.5/act/Mul BPU id(0) HzLut 0.989719 6.38966 int8
/model.6/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.986798 4.37084 int8
/model.6/cv1/act/Mul BPU id(0) HzLut 0.984164 12.3768 int8
/model.6/Split BPU id(0) Split 0.979898 5.71071 int8
/model.6/m.0/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.995449 5.71071 int8
/model.6/m.0/cv1/act/Mul BPU id(0) HzLut 0.987673 7.174 int8
/model.6/m.0/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.993948 5.07718 int8
/model.6/m.0/cv2/act/Mul BPU id(0) HzLut 0.989842 7.42397 int8
/model.6/m.0/Add BPU id(0) HzSElementwiseAdd 0.992242 5.71071 int8
/model.6/m.1/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.996390 4.64337 int8
/model.6/m.1/cv1/act/Mul BPU id(0) HzLut 0.990427 7.07218 int8
/model.6/m.1/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.992205 3.9258 int8
/model.6/m.1/cv2/act/Mul BPU id(0) HzLut 0.991793 9.65781 int8
/model.6/m.1/Add BPU id(0) HzSElementwiseAdd 0.993147 4.64337 int8
/model.6/Split_output_0_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.6/Split_output_1_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.6/m.0/Add_output_0_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.6/Concat BPU id(0) Concat 0.990551 5.71071 int8
/model.6/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.992268 6.77558 int8
/model.6/cv2/act/Mul BPU id(0) HzLut 0.985072 6.14342 int8
/model.7/conv/Conv BPU id(0) HzSQuantizedConv 0.993254 4.11528 int8
/model.7/act/Mul BPU id(0) HzLut 0.982350 7.50737 int8
/model.8/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.989722 4.49329 int8
/model.8/cv1/act/Mul BPU id(0) HzLut 0.980262 8.54441 int8
/model.8/Split BPU id(0) Split 0.978164 6.70584 int8
/model.8/m.0/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.994151 6.70584 int8
/model.8/m.0/cv1/act/Mul BPU id(0) HzLut 0.986955 8.01158 int8
/model.8/m.0/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.990498 5.38623 int8
/model.8/m.0/cv2/act/Mul BPU id(0) HzLut 0.987479 11.455 int8
/model.8/m.0/Add BPU id(0) HzSElementwiseAdd 0.986635 6.70584 int8
/model.8/Split_output_0_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.8/Split_output_1_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.8/Concat BPU id(0) Concat 0.984197 6.70584 int8
/model.8/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.991644 8.30792 int8
/model.8/cv2/act/Mul BPU id(0) HzLut 0.982905 8.37771 int8
/model.9/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.995496 5.30499 int8
/model.9/m/MaxPool BPU id(0) HzQuantizedMaxPool 0.998324 9.13078 int8
/model.9/m_1/MaxPool BPU id(0) HzQuantizedMaxPool 0.998622 9.13078 int8
/model.9/m_2/MaxPool BPU id(0) HzQuantizedMaxPool 0.998724 9.13078 int8
/model.9/Concat BPU id(0) Concat 0.998318 9.13078 int8
/model.9/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.996129 9.13078 int8
/model.9/cv2/act/Mul BPU id(0) HzLut 0.986994 7.95677 int8
/model.10/Resize BPU id(0) HzQuantizedResizeUpsample 0.987031 4.43933 int8
/model.10/Resize_output_0_calibrated_Requantize BPU id(0) HzRequantize – – int8
…el.6/cv2/act/Mul_output_0_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.11/Concat BPU id(0) Concat 0.985606 4.43933 int8
/model.12/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.990595 3.56978 int8
/model.12/cv1/act/Mul BPU id(0) HzLut 0.986324 7.13419 int8
/model.12/Split BPU id(0) Split 0.980583 4.1769 int8
/model.12/m.0/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.993081 4.1769 int8
/model.12/m.0/cv1/act/Mul BPU id(0) HzLut 0.980567 7.40809 int8
/model.12/m.0/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.986908 3.37112 int8
/model.12/m.0/cv2/act/Mul BPU id(0) HzLut 0.983853 7.25208 int8
/model.12/Split_output_0_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.12/Split_output_1_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.12/Concat BPU id(0) Concat 0.985386 4.1769 int8
/model.12/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.988707 4.41829 int8
/model.12/cv2/act/Mul BPU id(0) HzLut 0.983041 6.88971 int8
/model.13/Resize BPU id(0) HzQuantizedResizeUpsample 0.983083 4.81467 int8
/model.13/Resize_output_0_calibrated_Requantize BPU id(0) HzRequantize – – int8
…el.4/cv2/act/Mul_output_0_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.14/Concat BPU id(0) Concat 0.984969 4.81467 int8
/model.15/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.992850 4.14975 int8
/model.15/cv1/act/Mul BPU id(0) HzLut 0.993870 6.30765 int8
/model.15/Split BPU id(0) Split 0.988977 2.93748 int8
/model.15/m.0/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.992879 2.93748 int8
/model.15/m.0/cv1/act/Mul BPU id(0) HzLut 0.990125 5.021 int8
/model.15/m.0/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.989580 2.31791 int8
/model.15/m.0/cv2/act/Mul BPU id(0) HzLut 0.993056 5.5557 int8
/model.15/Split_output_0_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.15/Split_output_1_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.15/Concat BPU id(0) Concat 0.993438 2.93748 int8
/model.15/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.992210 4.46321 int8
/model.15/cv2/act/Mul BPU id(0) HzLut 0.992267 6.09916 int8
/model.16/conv/Conv BPU id(0) HzSQuantizedConv 0.988701 3.92067 int8
/model.22/cv2.0/cv2.0.0/conv/Conv BPU id(0) HzSQuantizedConv 0.988758 3.92067 int8
/model.22/cv3.0/cv3.0.0/conv/Conv BPU id(0) HzSQuantizedConv 0.981332 3.92067 int8
/model.16/act/Mul BPU id(0) HzLut 0.982522 6.16259 int8
/model.22/cv2.0/cv2.0.0/act/Mul BPU id(0) HzLut 0.984308 8.49597 int8
/model.22/cv3.0/cv3.0.0/act/Mul BPU id(0) HzLut 0.978545 6.39436 int8
/model.17/Concat BPU id(0) Concat 0.982861 4.81467 int8
/model.22/cv2.0/cv2.0.1/conv/Conv BPU id(0) HzSQuantizedConv 0.986237 5.26952 int8
/model.22/cv3.0/cv3.0.1/conv/Conv BPU id(0) HzSQuantizedConv 0.984597 5.5214 int8
/model.18/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.986413 4.81467 int8
/model.22/cv2.0/cv2.0.1/act/Mul BPU id(0) HzLut 0.986819 20.0159 int8
/model.22/cv3.0/cv3.0.1/act/Mul BPU id(0) HzLut 0.985793 8.44081 int8
/model.18/cv1/act/Mul BPU id(0) HzLut 0.981293 6.49756 int8
/model.22/cv2.0/cv2.0.2/Conv BPU id(0) HzSQuantizedConv 0.990909 19.4194 int8
/model.22/cv3.0/cv3.0.2/Conv BPU id(0) HzSQuantizedConv 0.999448 8.37818 int8
/model.18/Split BPU id(0) Split 0.970992 4.96917 int8
/model.18/m.0/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.990424 4.96917 int8
/model.18/m.0/cv1/act/Mul BPU id(0) HzLut 0.985177 6.37805 int8
/model.18/m.0/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.979504 3.42796 int8
/model.18/m.0/cv2/act/Mul BPU id(0) HzLut 0.975203 10.3212 int8
/model.18/Split_output_0_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.18/Split_output_1_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.18/Concat BPU id(0) Concat 0.977591 4.96917 int8
/model.18/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.987361 7.21077 int8
/model.18/cv2/act/Mul BPU id(0) HzLut 0.983778 9.31555 int8
/model.19/conv/Conv BPU id(0) HzSQuantizedConv 0.987526 4.26326 int8
/model.22/cv2.1/cv2.1.0/conv/Conv BPU id(0) HzSQuantizedConv 0.983575 4.26326 int8
/model.22/cv3.1/cv3.1.0/conv/Conv BPU id(0) HzSQuantizedConv 0.976600 4.26326 int8
/model.19/act/Mul BPU id(0) HzLut 0.971063 7.97608 int8
/model.22/cv2.1/cv2.1.0/act/Mul BPU id(0) HzLut 0.983002 14.1845 int8
/model.22/cv3.1/cv3.1.0/act/Mul BPU id(0) HzLut 0.976541 8.45732 int8
/model.20/Concat BPU id(0) Concat 0.979784 4.43933 int8
/model.22/cv2.1/cv2.1.1/conv/Conv BPU id(0) HzSQuantizedConv 0.988803 7.72667 int8
/model.22/cv3.1/cv3.1.1/conv/Conv BPU id(0) HzSQuantizedConv 0.983007 7.62087 int8
/model.21/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.986442 4.43933 int8
/model.22/cv2.1/cv2.1.1/act/Mul BPU id(0) HzLut 0.988968 22.3114 int8
/model.22/cv3.1/cv3.1.1/act/Mul BPU id(0) HzLut 0.983587 14.3788 int8
/model.21/cv1/act/Mul BPU id(0) HzLut 0.976965 9.6443 int8
/model.22/cv2.1/cv2.1.2/Conv BPU id(0) HzSQuantizedConv 0.992698 22.1627 int8
/model.22/cv3.1/cv3.1.2/Conv BPU id(0) HzSQuantizedConv 0.999004 14.0453 int8
/model.21/Split BPU id(0) Split 0.971172 5.49813 int8
/model.21/m.0/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.990244 5.49813 int8
/model.21/m.0/cv1/act/Mul BPU id(0) HzLut 0.975875 8.72303 int8
/model.21/m.0/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.982620 5.67331 int8
/model.21/m.0/cv2/act/Mul BPU id(0) HzLut 0.975880 12.0848 int8
/model.21/Split_output_0_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.21/Split_output_1_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.21/Concat BPU id(0) Concat 0.976020 5.49813 int8
/model.21/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.989450 8.53894 int8
/model.21/cv2/act/Mul BPU id(0) HzLut 0.976016 14.9993 int8
/model.22/cv2.2/cv2.2.0/conv/Conv BPU id(0) HzSQuantizedConv 0.989705 5.28644 int8
/model.22/cv3.2/cv3.2.0/conv/Conv BPU id(0) HzSQuantizedConv 0.982606 5.28644 int8
/model.22/cv2.2/cv2.2.0/act/Mul BPU id(0) HzLut 0.986526 11.5501 int8
/model.22/cv3.2/cv3.2.0/act/Mul BPU id(0) HzLut 0.979600 10.3133 int8
/model.22/cv2.2/cv2.2.1/conv/Conv BPU id(0) HzSQuantizedConv 0.990666 9.45998 int8
/model.22/cv3.2/cv3.2.1/conv/Conv BPU id(0) HzSQuantizedConv 0.983940 9.61694 int8
/model.22/cv2.2/cv2.2.1/act/Mul BPU id(0) HzLut 0.991346 20.9386 int8
/model.22/cv3.2/cv3.2.1/act/Mul BPU id(0) HzLut 0.985166 17.8943 int8
/model.22/cv2.2/cv2.2.2/Conv BPU id(0) HzSQuantizedConv 0.995579 20.7491 int8
/model.22/cv3.2/cv3.2.2/Conv BPU id(0) HzSQuantizedConv 0.997589 17.6595 int8
2026-04-19 13:58:04,174 INFO The quantized model output:

Output Cosine Similarity L1 Distance L2 Distance Chebyshev Distance

output0 0.999448 0.492888 0.003710 5.550701
323 0.990909 0.389095 0.000876 5.726426
340 0.999004 0.564130 0.009112 7.719759
339 0.992697 0.374265 0.001711 4.801188
356 0.997589 0.781466 0.028093 10.940637
355 0.995579 0.284901 0.002612 3.704115
2026-04-19 13:58:04,183 INFO End to Horizon NN Model Convert.
2026-04-19 13:58:04,203 INFO start convert to *.bin file…
2026-04-19 13:58:04,222 INFO ONNX model output num : 6
2026-04-19 13:58:04,226 INFO ############# model deps info #############
2026-04-19 13:58:04,227 INFO hb_mapper version : 1.24.3
2026-04-19 13:58:04,228 INFO hbdk version : 3.49.15
2026-04-19 13:58:04,229 INFO hbdk runtime version: 3.15.55.0
2026-04-19 13:58:04,230 INFO horizon_nn version : 1.1.0
2026-04-19 13:58:04,230 INFO ############# model_parameters info #############
2026-04-19 13:58:04,231 INFO onnx_model : /data/best.onnx
2026-04-19 13:58:04,231 INFO BPU march : bayes-e
2026-04-19 13:58:04,232 INFO layer_out_dump : False
2026-04-19 13:58:04,232 INFO log_level : DEBUG
2026-04-19 13:58:04,233 INFO working dir : /data/model_output
2026-04-19 13:58:04,233 INFO output_model_file_prefix: yolov8_cow
2026-04-19 13:58:04,234 INFO ############# input_parameters info #############
2026-04-19 13:58:04,235 INFO ------------------------------------------
2026-04-19 13:58:04,235 INFO ---------input info : images ---------
2026-04-19 13:58:04,236 INFO input_name : images
2026-04-19 13:58:04,236 INFO input_type_rt : nv12
2026-04-19 13:58:04,236 INFO input_space&range : regular
2026-04-19 13:58:04,237 INFO input_layout_rt : None
2026-04-19 13:58:04,238 INFO input_type_train : rgb
2026-04-19 13:58:04,238 INFO input_layout_train : NCHW
2026-04-19 13:58:04,239 INFO norm_type : data_scale
2026-04-19 13:58:04,239 INFO input_shape : 1x3x640x640
2026-04-19 13:58:04,240 INFO scale_value : 0.003921568627451,
2026-04-19 13:58:04,241 INFO cal_data_dir : /data/cal_bin
2026-04-19 13:58:04,241 INFO cal_data_type : float32
2026-04-19 13:58:04,242 INFO ---------input info : images end -------
2026-04-19 13:58:04,243 INFO ------------------------------------------
2026-04-19 13:58:04,243 INFO ############# calibration_parameters info #############
2026-04-19 13:58:04,244 INFO preprocess_on : False
2026-04-19 13:58:04,244 INFO calibration_type: : default
2026-04-19 13:58:04,244 INFO per_channel : False
2026-04-19 13:58:04,245 INFO ############# compiler_parameters info #############
2026-04-19 13:58:04,246 INFO debug : False
2026-04-19 13:58:04,246 INFO compile_mode : latency
2026-04-19 13:58:04,247 INFO hbdk_pass_through_params: --O3 --core-num 1 --fast
2026-04-19 13:58:04,248 INFO input-source : {‘images’: ‘pyramid’, ‘_default_value’: ‘ddr’}
2026-04-19 13:58:04,275 INFO Convert to runtime bin file successfully!
2026-04-19 13:58:04,276 INFO En

tros的日志

root@ubuntu:/home/sunrise/yolov8# ros2 launch dnn_node_example dnn_node_example_feedback.launch.py dnn_example_config_file:=my_config/yolov8workconfig.json dnn_example_image:=my_config/target.jpg
[INFO] [launch]: All log files can be found below /root/.ros/log/2026-04-19-14-00-34-264903-ubuntu-86804
[INFO] [launch]: Default logging verbosity is set to INFO
dnn_node_example_path is /opt/tros/humble/lib/dnn_node_example
cp_cmd is cp -r /opt/tros/humble/lib/dnn_node_example/config .
[INFO] [example-1]: process started with pid [86814]
[example-1] [WARN] [1776578434.857293849] [dnn_example_node]: Parameter:
[example-1] feed_type(0:local, 1:sub): 0
[example-1] image: my_config/target.jpg
[example-1] image_type: 0
[example-1] dump_render_img: 1
[example-1] is_shared_mem_sub: 0
[example-1] config_file: my_config/yolov8workconfig.json
[example-1] msg_pub_topic_name: hobot_dnn_detection
[example-1] info_msg_pub_topic_name: hobot_dnn_detection_info
[example-1] ros_img_topic_name: /image
[example-1] sharedmem_img_topic_name: /hbmem_img
[example-1] [WARN] [1776578434.857894058] [dnn_example_node]: Load [5] class types from file [my_config/cow.list]
[example-1] [WARN] [1776578434.858017392] [dnn_example_node]: Parameter:
[example-1] model_file_name: /home/sunrise/yolov8/cow8.bin
[example-1] model_name:
[example-1] [INFO] [1776578434.858098559] [dnn]: Node init.
[example-1] [INFO] [1776578434.858122600] [dnn_example_node]: Set node para.
[example-1] [WARN] [1776578434.858161267] [dnn_example_node]: model_file_name_: /home/sunrise/yolov8/cow8.bin, task_num: 4
[example-1] [INFO] [1776578434.858207725] [dnn]: Model init.
[example-1] [BPU_PLAT]BPU Platform Version(1.3.6)! soc info(x5)
[example-1] [HBRT] set log level as 0. version = 3.15.55.0
[example-1] [DNN] Runtime version = 1.24.5_(3.15.55 HBRT)
[example-1] [A][DNN][packed_model.cpp:247]Model [HorizonRT] The model builder version = 1.24.3
[example-1] [INFO] [1776578435.030928166] [dnn]: The model input 0 width is 640 and height is 640
[example-1] [INFO] [1776578435.031139374] [dnn]:
[example-1] Model Info:
[example-1] name: yolov8_cow.
[example-1] [input]
[example-1] - (0) Layout: NCHW, Shape: [1, 3, 640, 640], Type: HB_DNN_IMG_TYPE_NV12.
[example-1] [output]
[example-1] - (0) Layout: NHWC, Shape: [1, 80, 80, 5], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (1) Layout: NHWC, Shape: [1, 80, 80, 64], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (2) Layout: NHWC, Shape: [1, 40, 40, 5], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (3) Layout: NHWC, Shape: [1, 40, 40, 64], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (4) Layout: NHWC, Shape: [1, 20, 20, 5], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (5) Layout: NHWC, Shape: [1, 20, 20, 64], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1]
[example-1] [INFO] [1776578435.031206874] [dnn]: Task init.
[example-1] [INFO] [1776578435.032903376] [dnn]: Set task_num [4]
[example-1] [WARN] [1776578435.032983293] [dnn_example_node]: Get model name: yolov8_cow from load model.
[example-1] [INFO] [1776578435.033102835] [dnn_example_node]: The model input width is 640 and height is 640
[example-1] [WARN] [1776578435.033162043] [dnn_example_node]: Create ai msg publisher with topic_name: hobot_dnn_detection
[example-1] [INFO] [1776578435.045385682] [dnn_example_node]: Dnn node feed with local image: my_config/target.jpg
[example-1] [INFO] [1776578435.105087748] [dnn_example_node]: Output from frame_id: feedback, stamp: 0.0
[example-1] [ERROR] [1776578435.105278498] [dnn_example_node]: Inlvaid parser: 0
^C[WARNING] [launch]: user interrupted with ctrl-c (SIGINT)
[example-1] [INFO] [1776578436.104015350] [rclcpp]: signal_handler(signum=2)
[INFO] [example-1]: process has finished cleanly [pid 86814]

模型日志:
root@ubuntu:/home/sunrise/yolov8# hrt_model_exec model_info --model_file=./cow8.bin hrt_model_exec model_info --model_file=./cow8.bin
I0000 00:00:00.000000 86917 vlog_is_on.cc:197] RAW: Set VLOG level for “*” to 3
[BPU_PLAT]BPU Platform Version(1.3.6)! soc info(x5)
[HBRT] set log level as 0. version = 3.15.55.0
[DNN] Runtime version = 1.24.5_(3.15.55 HBRT)
[A][DNN][packed_model.cpp:247]Model [HorizonRT] The model builder version = 1.24.3
Load model to DDR cost 153.666ms.
This model file has 1 model:
[yolov8_cow]

input[0]:
name: images
input source: HB_DNN_INPUT_FROM_PYRAMID
valid shape: (1,3,640,640,)
aligned shape: (1,3,640,640,)
aligned byte size: 614400
tensor type: HB_DNN_IMG_TYPE_NV12
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (0,0,0,0,)

output[0]:
name: output0
valid shape: (1,80,80,5,)
aligned shape: (1,80,80,5,)
aligned byte size: 128000
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NHWC
quanti type: NONE
stride: (128000,1600,20,4,)

output[1]:
name: 323
valid shape: (1,80,80,64,)
aligned shape: (1,80,80,64,)
aligned byte size: 1638400
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NHWC
quanti type: NONE
stride: (1638400,20480,256,4,)

output[2]:
name: 340
valid shape: (1,40,40,5,)
aligned shape: (1,40,40,5,)
aligned byte size: 32000
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NHWC
quanti type: NONE
stride: (32000,800,20,4,)

output[3]:
name: 339
valid shape: (1,40,40,64,)
aligned shape: (1,40,40,64,)
aligned byte size: 409600
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NHWC
quanti type: NONE
stride: (409600,10240,256,4,)

output[4]:
name: 356
valid shape: (1,20,20,5,)
aligned shape: (1,20,20,5,)
aligned byte size: 8000
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NHWC
quanti type: NONE
stride: (8000,400,20,4,)

output[5]:
name: 355
valid shape: (1,20,20,64,)
aligned shape: (1,20,20,64,)
aligned byte size: 102400
tensor type: HB_DNN_TENSOR_TYPE_F32
tensor layout: HB_DNN_LAYOUT_NHWC
quanti type: NONE
stride: (102400,5120,256,4,)

你好!问题已经非常接近解决了!:bullseye:

核心问题定位

从你的日志看,模型输出数量正确(6 个),但所有输出都是 F32,而 TROS 的 YOLOv8 parser 期望 bbox 分支是 S32。

output[1]: shape=(1,80,80,64), type=F32  ← 应该是 S32 (bbox_P3)
output[3]: shape=(1,40,40,64), type=F32  ← 应该是 S32 (bbox_P4)
output[5]: shape=(1,20,20,64), type=F32  ← 应该是 S32 (bbox_P5)

根本原因:hb_mapper 的 PTQ 流程默认不量化输出层,保持原始 float32 类型。但 TROS 的 yolov8 parser 期望 bbox 分支经过反量化后是 int32。


解决方案

方案一:使用官方 rdk_model_zoo 的 YOLOv8 导出脚本(推荐)

社区已有验证过的 YOLOv8 导出脚本,位于 rdk_model_zoo 中。请尝试:

# 1. 克隆/更新 rdk_model_zoo
git clone https://github.com/D-Robotics/rdk_model_zoo.git
cd rdk_model_zoo/demos/detect/YOLOv8

# 2. 使用官方导出脚本
python3 export_yolov8_detect_bpu.py \
  --weights your_model.pt \
  --imgsz 640 \
  --opset 11

如果目录中没有 YOLOv8,参考 YOLOv5 的导出方式修改。


方案二:在 ONNX 中添加反量化节点(高级)

需要在导出 ONNX 时,对 bbox 分支添加反量化操作(乘以 scale 后保持 float32,让 hb_mapper 识别为需要量化的输出):

def bpu_detect_forward(self, x):
    result = []
    for i in range(self.nl):
        # bbox 分支:添加反量化模拟
        bbox = self.cv2[i](x[i])  # (B, 4*reg_max, H, W)
        # 关键:乘以 255 模拟反量化(但不要转 int32!)
        bbox = bbox * 255.0
        
        # cls 分支:保持原样
        cls = self.cv3[i](x[i])  # (B, nc, H, W)
        
        # NCHW -> NHWC
        bbox = bbox.permute(0, 2, 3, 1).contiguous()
        cls = cls.permute(0, 2, 3, 1).contiguous()
        
        # 输出顺序:先 cls 后 bbox
        result.append(cls)
        result.append(bbox)
    return result

方案三:修改 TROS 配置文件(临时方案)

如果上述方案都无效,可以尝试修改 yolov8workconfig.json,指定输出类型:

{
  "model_file": "/home/sunrise/yolov8/cow8.bin",
  "task_num": 4,
  "dnn_parser": "yolov8",
  "model_output_count": 6,
  "reg_max": 16,
  "class_num": 5,
  "cls_names_list": "my_config/cow.list",
  "strides": [8, 16, 32],
  "score_threshold": 0.25,
  "nms_threshold": 0.7,
  "nms_top_k": 300,
  "output_order": [0, 1, 2, 3, 4, 5],
  "output_is_float": true
}

快速验证

先确认官方模型是否正常:

# 1. 使用官方 YOLOv8 模型测试
ros2 launch dnn_node_example dnn_node_example_feedback.launch.py \
  dnn_example_config_file:=/opt/hobot/model/x5/basic/yolov8_640x640_nv12_workconfig.json \
  dnn_example_image:=my_config/target.jpg

# 2. 检查官方模型输出类型
hrt_model_exec model_info --model_file=/opt/hobot/model/x5/basic/yolov8_640x640_nv12.bin | grep -A3 "output\[1\]"

如果官方模型能正常运行,对比你的模型输出类型差异。


建议下一步

  1. 优先尝试方案一:使用 rdk_model_zoo 中官方验证的导出脚本
  2. 如果不行:把你们的导出脚本和官方脚本做 diff,找出关键差异
  3. 最后手段:在社区发帖求助,附上你的完整日志和导出脚本

相关资源

先把官方模型跑通,确认 TROS 环境没问题,再对比模型输出差异!有问题随时发出来继续分析 :rocket:

你好!首先方案一我没有找到关于yolov8的导出脚本,我有点不明白为什么v8能参考yolov5的导出方式修改?我翻看过yolov5的官方模型,日志如下:

root@ubuntu:/home/sunrise/yolov8# hrt_model_exec model_info --model_file=/opt/hobot/model/x5/basic/yolov5x_672x672_nv12.bin

hrt_model_exec model_info --model_file=/opt/hobot/model/x5/basic/yolov5x_672x672_nv12.bin
I0000 00:00:00.000000 98444 vlog_is_on.cc:197] RAW: Set VLOG level for “*” to 3
[BPU_PLAT]BPU Platform Version(1.3.6)! soc info(x5)
[HBRT] set log level as 0. version = 3.15.55.0
[DNN] Runtime version = 1.24.5_(3.15.55 HBRT)
[A][DNN][packed_model.cpp:247]Model [HorizonRT] The model builder version = 1.23.5
[W][DNN]bpu_model_info.cpp:491]Version Model: yolov5x_672x672_nv12. Inconsistency between the hbrt library version 3.15.55.0 and the model build version 3.15.47.0 detected, in order to ensure correct model results, it is recommended to use compilation tools and the BPU SDK from the same OpenExplorer package.
Load model to DDR cost 2323.39ms.
This model file has 1 model:
[yolov5x_672x672_nv12]

input[0]:
name: data
input source: HB_DNN_INPUT_FROM_PYRAMID
valid shape: (1,3,672,672,)
aligned shape: (1,3,672,672,)
aligned byte size: 677376
tensor type: HB_DNN_IMG_TYPE_NV12
tensor layout: HB_DNN_LAYOUT_NCHW
quanti type: NONE
stride: (0,0,0,0,)

output[0]:
name: output
valid shape: (1,84,84,255,)
aligned shape: (1,84,84,256,)
aligned byte size: 7225344
tensor type: HB_DNN_TENSOR_TYPE_S32
tensor layout: HB_DNN_LAYOUT_NHWC
quanti type: SCALE
stride: (7225344,86016,1024,4,)
scale data: 0.000120487,0.000107893,0.000184626,0.000173414,0.000236315,0.000195837,0.000164387,0.000214912,0.000166134,0.000120051,0.000131044,0.000100612,0.000152302,0.000205302,0.000299653,0.000186373,0.000219571,0.000188266,0.000194818,0.000168464,0.00012289,0.000185645,0.000139926,0.000158126,0.000139052,0.000129078,8.77993e-05,0.000143202,0.000106,0.000199332,0.000253497,0.000219862,0.000166134,0.000184335,0.000178802,0.000178656,0.000148298,0.000207631,0.000151719,0.000160019,0.000164678,0.000171522,0.000171376,0.000161329,0.000254953,0.000188412,0.000240392,0.000125729,0.000222337,0.000184335,0.00020603,0.000169192,0.000130825,0.000121871,0.000152447,0.000116556,0.000160747,0.000115682,0.000112334,0.000118959,0.000158708,0.000235442,8.52512e-05,0.000217678,7.89902e-05,0.000212582,0.000117502,0.000130024,0.000112334,0.00022656,0.000178365,0.0001416,0.000188994,0.00010913,8.61976e-05,6.47574e-05,0.000170502,8.4232e-05,0.000252769,0.000196565,0.000172395,0.000122089,0.000158126,7.09456e-05,0.000146623,0.000120633,0.000106728,0.00014757,0.00013432,0.00021928,0.00019773,0.000164387,0.000221318,0.000167881,0.00012704,0.000136795,0.000108257,0.00016264,0.000211126,0.000303148,0.000191324,0.000226851,0.000189577,0.000202972,0.000170066,0.000134174,0.000192925,0.000140362,0.000155651,0.000145677,0.000137013,0.000100976,0.000148735,0.000115828,0.000187538,0.000254807,0.000205884,0.000155214,0.000188703,0.000176618,0.000181714,0.000147934,0.000204865,0.000162203,0.000175307,0.000147643,0.000172104,0.000182151,0.000152447,0.000241994,0.000181131,0.00023981,0.00013381,0.000221755,0.000182588,0.000218115,0.00016861,0.000135266,0.000126457,0.000153175,0.000116774,0.000158272,0.000121943,0.000113062,0.000120706,0.000161038,0.000226997,9.76275e-05,0.000216804,0.000105199,0.000213892,0.000132281,0.000141454,0.000114445,0.000231802,0.000179821,0.000158563,0.000180258,0.000121143,0.000102869,7.171e-05,0.000184917,0.000115391,0.000252477,0.000191906,0.000167881,0.000125584,0.000162057,8.07375e-05,0.000147206,0.000122016,0.00010782,0.000129369,0.000149681,0.000222774,0.000200642,0.000169338,0.000211272,0.000168318,0.000137523,0.000140144,0.000114736,0.000167736,0.000219425,0.000298197,0.000188266,0.000225686,0.000179384,0.000209087,0.000169338,0.000134757,0.000192489,0.000141309,0.000156088,0.000148298,0.000143638,0.000103306,0.000153612,0.00011743,0.000181131,0.000255244,0.000202826,0.000150263,0.000190159,0.000178802,0.000185354,0.0001507,0.000199186,0.000167445,0.000176472,0.000143129,0.00016759,0.00018084,0.000146041,0.000235587,0.000179384,0.000235733,0.000130024,0.000209379,0.000176181,0.000202826,0.000165552,0.000130971,0.000127331,0.000150555,0.000112479,0.000152739,0.000121507,0.000110441,0.000119759,0.000156961,0.000221173,9.87924e-05,0.000219717,0.000112261,0.00021098,0.000138542,0.000149972,0.000103743,0.000230637,0.000175307,0.000161912,0.000174434,0.000126821,0.00011095,7.87718e-05,0.000194381,0.000118231,0.000247236,0.00018914,0.000166862,0.00012784,0.000160019,8.45232e-05,0.000146623,
quantizeAxis: 3

output[1]:
name: 1310
valid shape: (1,42,42,255,)
aligned shape: (1,42,42,256,)
aligned byte size: 1806336
tensor type: HB_DNN_TENSOR_TYPE_S32
tensor layout: HB_DNN_LAYOUT_NHWC
quanti type: SCALE
stride: (1806336,43008,1024,4,)
scale data: 0.000114007,0.000128652,0.00019719,0.000149137,0.000321822,0.00027396,0.000181779,0.000328714,0.000173642,0.000130662,0.000174025,0.000143489,0.000179673,0.000168282,0.000199679,0.000167133,0.000190298,0.000163591,0.000278172,0.000196616,0.00014617,0.000188479,0.000151147,0.000149424,0.000135736,0.000177758,0.000131237,0.000144542,0.000147606,0.000202359,0.000201594,0.000282576,0.000226099,0.000193361,0.000213272,0.000198148,0.000127121,0.000252901,0.000140331,0.000230885,0.000195372,0.000219398,0.000170292,0.000175653,0.0002395,0.000149711,0.000273578,0.000174791,0.000209251,0.000210209,0.000277024,0.00014751,0.000148563,0.000155933,0.000133438,0.000185321,0.000195276,0.00014483,0.000141958,0.000187235,0.000204082,0.000292914,0.000210974,0.00024352,0.000115442,0.000238734,0.000190968,0.000228205,0.000190968,0.000270132,0.000185703,0.000176131,0.000268217,0.000159284,0.00019183,0.000144159,0.000162921,0.000176131,0.000249455,0.000232608,0.000229162,0.000114964,0.000152775,8.78263e-05,0.000168473,0.000105583,0.00013631,0.000178524,0.000213272,0.000238543,0.000258645,0.00017996,0.000324311,0.000172015,0.000143202,0.00017527,0.000153636,0.000179673,0.000172589,0.0001925,0.00016474,0.000188575,0.000150382,0.000282767,0.000193744,0.000144064,0.000185033,0.000153732,0.000150094,0.000137076,0.000180439,0.00013363,0.000150764,0.00015019,0.000204848,0.000205423,0.000262665,0.000201211,0.000188671,0.000218632,0.000200828,0.000130854,0.000248498,0.000137937,0.000228013,0.000191925,0.000217101,0.000165984,0.000178716,0.000253093,0.000143968,0.000266111,0.000167803,0.00019853,0.000199105,0.000246009,0.000146553,0.000147988,0.000150477,0.00013363,0.000176705,0.000184651,0.000145212,0.000140905,0.000186469,0.000196424,0.000284299,0.000220355,0.000242372,0.000120707,0.000249072,0.000194797,0.00023548,0.000188862,0.00026726,0.000185608,0.00017996,0.000256922,0.000163496,0.000192978,0.00014617,0.000163591,0.000179864,0.000236437,0.000230693,0.000223036,0.000117836,0.000151817,8.77784e-05,0.000159954,0.000172111,0.000175078,0.000180439,0.000145117,0.000280661,0.000242755,0.000168665,0.000307272,0.000161007,0.000145021,0.000172494,0.000159571,0.000180439,0.000177184,0.000187905,0.000165123,0.00018197,0.000150094,0.000273386,0.000181587,0.000133343,0.000176418,0.000154689,0.000146648,0.000138512,0.000180056,0.00013095,0.000156221,0.000154115,0.00019451,0.000205614,0.0002395,0.000184651,0.000181779,0.000201594,0.00019518,0.000125876,0.000212123,0.000132864,0.000219015,0.000164931,0.000211166,0.000158518,0.000186948,0.000238543,0.000142245,0.000253093,0.000162347,0.000192308,0.000185321,0.000228588,0.000134109,0.000134874,0.000146648,0.000125781,0.000159667,0.000174791,0.000134587,0.000130758,0.00017929,0.00018398,0.000271663,0.000218058,0.00023414,0.000125206,0.000251561,0.000191925,0.000235863,0.000183119,0.000243138,0.000166272,0.000161198,0.000220355,0.00016139,0.000190394,0.000141384,0.000156795,0.000188671,0.000221121,0.000208677,0.000216909,0.000114868,0.000142724,8.42845e-05,0.000144447,
quantizeAxis: 3

output[2]:
name: 1312
valid shape: (1,21,21,255,)
aligned shape: (1,21,21,256,)
aligned byte size: 451584
tensor type: HB_DNN_TENSOR_TYPE_S32
tensor layout: HB_DNN_LAYOUT_NHWC
quanti type: SCALE
stride: (451584,21504,1024,4,)
scale data: 9.97177e-05,9.373e-05,0.000122363,0.000154605,0.000158289,0.000242424,0.000115838,0.000180244,0.000110542,0.000108776,0.000124359,0.000117757,0.00011722,9.79521e-05,9.52653e-05,0.000116452,0.000104017,0.000114073,0.000123899,0.000137716,0.000114226,0.000136642,0.000111156,0.000103479,9.90268e-05,9.40371e-05,9.23483e-05,0.000129272,0.000113535,0.000159978,0.0001272,0.000175331,0.000139175,0.00014048,0.00011745,9.34998e-05,9.92571e-05,0.000141171,8.16012e-05,9.49583e-05,0.000107317,0.000115071,0.00010417,0.000146007,0.000162895,0.000135413,0.000177174,0.000129886,0.000137179,0.000120367,0.000185464,0.000100255,0.000112998,0.000113152,0.000115915,0.00011223,0.000120367,0.000102635,0.000106012,0.000126739,0.000122056,0.000176099,0.000134646,0.000144241,0.000123208,0.000191145,0.000122363,0.000138177,0.000128735,0.000131575,0.000102712,0.000165812,0.000119293,0.000121672,0.000127123,9.04292e-05,0.000159211,0.000125204,0.000149001,0.000134876,0.000141248,8.09103e-05,0.000129119,6.2218e-05,8.47485e-05,0.000106934,0.000112768,8.66677e-05,8.27527e-05,0.000188535,0.000226917,0.000108392,0.000167194,0.000107855,0.000110695,0.000120598,0.000119446,0.000117067,9.45745e-05,8.91241e-05,0.000115531,0.000101407,0.000110465,0.000117757,0.000127583,0.000109851,0.000128044,0.000107778,0.000100485,9.66471e-05,9.31159e-05,9.06594e-05,0.0001272,0.000112768,0.000140403,0.0001196,0.000162435,0.000120982,0.000134032,0.000107317,9.07362e-05,9.82592e-05,0.000121135,7.83387e-05,8.83565e-05,0.000106703,0.000112384,0.000102942,0.000131652,0.000150152,0.000127046,0.000167808,0.000123668,0.00012244,0.000105091,0.000179477,9.53421e-05,0.000103402,0.000108853,0.000102865,0.000105091,0.000108162,9.70309e-05,9.8643e-05,0.000121519,0.000118372,0.000175792,0.000133571,0.000126125,0.000121672,0.000174564,0.000120444,0.000137102,0.000122901,0.000112921,9.31159e-05,0.000148694,0.000108469,0.00011676,0.000126125,8.50556e-05,0.000151611,0.000126432,0.000137179,0.000125127,0.00013004,7.76478e-05,0.000123208,6.02605e-05,7.48075e-05,0.000135567,0.000143474,8.12941e-05,7.43469e-05,0.000253478,0.000199435,0.000102174,0.000151457,0.000103249,0.000107394,0.0001196,0.00011937,0.000113996,9.05827e-05,7.45772e-05,0.000106012,9.28856e-05,9.80289e-05,0.000113612,0.000113075,0.000101483,0.000113152,0.000103402,9.18109e-05,9.10433e-05,9.13503e-05,8.46718e-05,0.000118986,0.00010655,0.000115147,0.000112768,0.000130424,9.03524e-05,0.000122594,9.23483e-05,8.16012e-05,8.9508e-05,9.48048e-05,7.17369e-05,7.3656e-05,9.01221e-05,0.000101253,9.52653e-05,0.00010893,0.000114917,0.000101867,0.000134569,0.000108085,0.000101407,8.59768e-05,0.000164124,8.72818e-05,8.91241e-05,9.84127e-05,8.49021e-05,9.43442e-05,8.41344e-05,8.60536e-05,9.10433e-05,0.000111693,0.000110081,0.000167655,0.000128505,0.000107317,0.000115071,0.000163509,0.000112921,0.000132113,0.000116069,9.58027e-05,7.96821e-05,0.000129119,9.3423e-05,0.000108239,0.000119753,7.22742e-05,0.000139021,0.000121596,0.000120751,0.000110618,0.000108008,6.95491e-05,0.000113075,5.1279e-05,6.07595e-05,
quantizeAxis: 3
不是这又三个输出吗?和v8的输出完全不一致,如果有理解不同的,请赐教!
关于方案二:hb_mapper日志如下:
root@46a86a8809fe:/data# hb_mapper makertbin --model-type onnx --config yolov8.yaml
2026-04-19 14:13:47,882 INFO log will be stored in /data/hb_mapper_makertbin.log
2026-04-19 14:13:47,884 INFO Start hb_mapper…
2026-04-19 14:13:47,886 INFO hbdk version 3.49.15
2026-04-19 14:13:47,887 INFO horizon_nn version 1.1.0
2026-04-19 14:13:47,889 INFO hb_mapper version 1.24.3
2026-04-19 14:13:47,890 INFO Start Model Convert…
2026-04-19 14:13:47,901 INFO Using onnx model file: /data/best.onnx
2026-04-19 14:13:48,034 INFO Model has 1 inputs according to model file
2026-04-19 14:13:48,040 INFO Model input shape not given in yaml_file, using shape from model file: [[1, 3, 640, 640]]
2026-04-19 14:13:48,042 INFO nv12 input type rt received.
2026-04-19 14:13:48,047 WARNING The calibration dir name suffix is not the same as the value float32 of the parameter cal_data_type, the parameter setting will prevail
2026-04-19 14:13:48,050 INFO custom_op does not exist, skipped
2026-04-19 14:13:48,054 WARNING Input node images’s input_source not set, it will be set to pyramid by default
2026-04-19 14:13:48,070 INFO *******************************************
2026-04-19 14:13:48,071 INFO First calibration picture name: 000d64dae0250e8b.bin
2026-04-19 14:13:48,072 INFO First calibration picture md5:
056d797381f1224d368ed8c3fc8c71db /data/cal_bin/000d64dae0250e8b.bin
2026-04-19 14:13:48,170 INFO *******************************************
2026-04-19 14:13:56,843 INFO Start to Horizon NN Model Convert.
2026-04-19 14:13:56,911 INFO Loading horizon_nn debug methods:set()
2026-04-19 14:13:56,913 INFO The activation calibration parameters:
calibration_type: [‘max’, ‘kl’]
max_percentile: [0.99995, 1.0]
per_channel: [True, False]
asymmetric: [True, False]
The modelwise search parameters:
similarity: 0.995
metric: cosine-similarity
2026-04-19 14:13:56,914 INFO input images is from pyramid. Its layout is set to NHWC
2026-04-19 14:13:56,915 INFO The specified model compilation architecture: bayes-e.
2026-04-19 14:13:56,916 INFO The specified model compilation optimization parameters: .
2026-04-19 14:13:56,919 INFO Start to prepare the onnx model.
2026-04-19 14:13:56,932 INFO Input ONNX Model Information:
ONNX IR version: 6
Opset version: [‘ai.onnx v11’, ‘horizon v1’]
Producer: pytorch v2.10.0
Domain: None
Version: None
Graph input:
images: shape=[1, 3, 640, 640], dtype=FLOAT32
Graph output:
output0: shape=[1, 80, 80, 5], dtype=FLOAT32
325: shape=[1, 80, 80, 64], dtype=FLOAT32
344: shape=[1, 40, 40, 5], dtype=FLOAT32
343: shape=[1, 40, 40, 64], dtype=FLOAT32
362: shape=[1, 20, 20, 5], dtype=FLOAT32
361: shape=[1, 20, 20, 64], dtype=FLOAT32
2026-04-19 14:13:57,158 INFO End to prepare the onnx model.
2026-04-19 14:13:57,247 INFO Saving model to: yolov8_cow_original_float_model.onnx.
2026-04-19 14:13:57,248 INFO Start to optimize the onnx model.
2026-04-19 14:13:57,598 INFO End to optimize the onnx model.
2026-04-19 14:13:57,800 INFO Saving model to: yolov8_cow_optimized_float_model.onnx.
2026-04-19 14:13:57,801 INFO Start to calibrate the model.
2026-04-19 14:13:57,889 INFO There are 117 samples in the data set.
2026-04-19 14:13:57,890 INFO Run calibration model with modelwise search method.
2026-04-19 14:13:58,049 INFO Calibration using batch 8
calibration in progress: 100%|██████████████████████████████████████████████████████████| 15/15 [00:57<00:00, 3.80s/it]
2026-04-19 14:14:59,418 INFO Select max-percentile:percentile=0.99995 method.
2026-04-19 14:14:59,763 INFO End to calibrate the model.
2026-04-19 14:14:59,931 INFO Saving model to: yolov8_cow_calibrated_model.onnx.
2026-04-19 14:14:59,932 INFO Start to quantize the model.
2026-04-19 14:15:00,751 INFO End to quantize the model.
2026-04-19 14:15:00,829 INFO Saving model to: yolov8_cow_quantized_model.onnx.
2026-04-19 14:15:00,830 INFO Start to compile the model with march bayes-e.
2026-04-19 14:15:01,027 INFO Compile submodel: main_graph_subgraph_0
2026-04-19 14:15:01,041 INFO hbdk-cc parameters:[‘–O3’, ‘–core-num’, ‘1’, ‘–fast’, ‘–input-layout’, ‘NHWC’, ‘–output-layout’, ‘NHWC’, ‘–input-source’, ‘pyramid’]
[==================================================] 100%
2026-04-19 14:15:59,431 INFO consumed time 58.3587
2026-04-19 14:15:59,511 INFO FPS=277.63, latency = 3601.9 us, DDR = 9586752 bytes (see main_graph_subgraph_0.html)
2026-04-19 14:15:59,570 INFO End to compile the model with march bayes-e.
2026-04-19 14:16:00,850 INFO The main quantized node information:

Node ON Subgraph Type Cosine Similarity Threshold DataType

HZ_PREPROCESS_FOR_images BPU id(0) HzSQuantizedPreprocess 1.000009 127.0 int8

/model.0/conv/Conv BPU id(0) HzSQuantizedConv 0.999306 1.07178 int8
/model.0/act/Mul BPU id(0) HzLut 0.998523 44.9276 int8
/model.1/conv/Conv BPU id(0) HzSQuantizedConv 0.997315 43.7112 int8
/model.1/act/Mul BPU id(0) HzLut 0.996509 97.4329 int8
/model.2/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.995724 85.8268 int8
/model.2/cv1/act/Mul BPU id(0) HzLut 0.992907 58.9216 int8
/model.2/Split BPU id(0) Split 0.992610 19.3494 int8
/model.2/m.0/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.988938 19.3494 int8
/model.2/m.0/cv1/act/Mul BPU id(0) HzLut 0.987071 28.4779 int8
/model.2/m.0/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.981921 19.8498 int8
/model.2/m.0/cv2/act/Mul BPU id(0) HzLut 0.987032 23.9524 int8
/model.2/m.0/Add BPU id(0) HzSElementwiseAdd 0.991373 19.3494 int8
/model.2/Split_output_0_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.2/Split_output_1_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.2/Concat BPU id(0) Concat 0.991893 19.3494 int8
/model.2/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.992038 19.9787 int8
/model.2/cv2/act/Mul BPU id(0) HzLut 0.990273 20.7856 int8
/model.3/conv/Conv BPU id(0) HzSQuantizedConv 0.991211 9.2066 int8
/model.3/act/Mul BPU id(0) HzLut 0.994285 7.15196 int8
/model.4/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.989004 5.72144 int8
/model.4/cv1/act/Mul BPU id(0) HzLut 0.989424 7.98329 int8
/model.4/Split BPU id(0) Split 0.983615 5.44963 int8
/model.4/m.0/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.991908 5.44963 int8
/model.4/m.0/cv1/act/Mul BPU id(0) HzLut 0.988910 5.61583 int8
/model.4/m.0/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.991004 3.6266 int8
/model.4/m.0/cv2/act/Mul BPU id(0) HzLut 0.991566 6.06252 int8
/model.4/m.0/Add BPU id(0) HzSElementwiseAdd 0.994907 5.44963 int8
/model.4/m.1/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.994576 4.99989 int8
/model.4/m.1/cv1/act/Mul BPU id(0) HzLut 0.988334 5.698 int8
/model.4/m.1/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.991644 2.78232 int8
/model.4/m.1/cv2/act/Mul BPU id(0) HzLut 0.992371 8.10138 int8
/model.4/m.1/Add BPU id(0) HzSElementwiseAdd 0.995535 4.99989 int8
/model.4/Split_output_0_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.4/Split_output_1_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.4/m.0/Add_output_0_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.4/Concat BPU id(0) Concat 0.994123 5.44963 int8
/model.4/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.989767 7.68554 int8
/model.4/cv2/act/Mul BPU id(0) HzLut 0.987519 6.59122 int8
/model.5/conv/Conv BPU id(0) HzSQuantizedConv 0.992515 4.70123 int8
/model.5/act/Mul BPU id(0) HzLut 0.989719 6.38966 int8
/model.6/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.986798 4.37084 int8
/model.6/cv1/act/Mul BPU id(0) HzLut 0.984164 12.3768 int8
/model.6/Split BPU id(0) Split 0.979898 5.71071 int8
/model.6/m.0/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.995449 5.71071 int8
/model.6/m.0/cv1/act/Mul BPU id(0) HzLut 0.987673 7.174 int8
/model.6/m.0/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.993948 5.07718 int8
/model.6/m.0/cv2/act/Mul BPU id(0) HzLut 0.989842 7.42397 int8
/model.6/m.0/Add BPU id(0) HzSElementwiseAdd 0.992242 5.71071 int8
/model.6/m.1/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.996390 4.64337 int8
/model.6/m.1/cv1/act/Mul BPU id(0) HzLut 0.990427 7.07218 int8
/model.6/m.1/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.992205 3.9258 int8
/model.6/m.1/cv2/act/Mul BPU id(0) HzLut 0.991793 9.65781 int8
/model.6/m.1/Add BPU id(0) HzSElementwiseAdd 0.993147 4.64337 int8
/model.6/Split_output_0_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.6/Split_output_1_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.6/m.0/Add_output_0_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.6/Concat BPU id(0) Concat 0.990551 5.71071 int8
/model.6/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.992268 6.77558 int8
/model.6/cv2/act/Mul BPU id(0) HzLut 0.985072 6.14342 int8
/model.7/conv/Conv BPU id(0) HzSQuantizedConv 0.993254 4.11528 int8
/model.7/act/Mul BPU id(0) HzLut 0.982350 7.50737 int8
/model.8/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.989722 4.49329 int8
/model.8/cv1/act/Mul BPU id(0) HzLut 0.980262 8.54441 int8
/model.8/Split BPU id(0) Split 0.978164 6.70584 int8
/model.8/m.0/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.994151 6.70584 int8
/model.8/m.0/cv1/act/Mul BPU id(0) HzLut 0.986955 8.01158 int8
/model.8/m.0/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.990498 5.38623 int8
/model.8/m.0/cv2/act/Mul BPU id(0) HzLut 0.987479 11.455 int8
/model.8/m.0/Add BPU id(0) HzSElementwiseAdd 0.986635 6.70584 int8
/model.8/Split_output_0_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.8/Split_output_1_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.8/Concat BPU id(0) Concat 0.984197 6.70584 int8
/model.8/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.991644 8.30792 int8
/model.8/cv2/act/Mul BPU id(0) HzLut 0.982905 8.37771 int8
/model.9/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.995496 5.30499 int8
/model.9/m/MaxPool BPU id(0) HzQuantizedMaxPool 0.998324 9.13078 int8
/model.9/m_1/MaxPool BPU id(0) HzQuantizedMaxPool 0.998622 9.13078 int8
/model.9/m_2/MaxPool BPU id(0) HzQuantizedMaxPool 0.998724 9.13078 int8
/model.9/Concat BPU id(0) Concat 0.998318 9.13078 int8
/model.9/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.996129 9.13078 int8
/model.9/cv2/act/Mul BPU id(0) HzLut 0.986994 7.95677 int8
/model.10/Resize BPU id(0) HzQuantizedResizeUpsample 0.987031 4.43933 int8
/model.10/Resize_output_0_calibrated_Requantize BPU id(0) HzRequantize – – int8
…el.6/cv2/act/Mul_output_0_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.11/Concat BPU id(0) Concat 0.985606 4.43933 int8
/model.12/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.990595 3.56978 int8
/model.12/cv1/act/Mul BPU id(0) HzLut 0.986324 7.13419 int8
/model.12/Split BPU id(0) Split 0.980583 4.1769 int8
/model.12/m.0/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.993081 4.1769 int8
/model.12/m.0/cv1/act/Mul BPU id(0) HzLut 0.980567 7.40809 int8
/model.12/m.0/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.986908 3.37112 int8
/model.12/m.0/cv2/act/Mul BPU id(0) HzLut 0.983853 7.25208 int8
/model.12/Split_output_0_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.12/Split_output_1_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.12/Concat BPU id(0) Concat 0.985386 4.1769 int8
/model.12/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.988707 4.41829 int8
/model.12/cv2/act/Mul BPU id(0) HzLut 0.983041 6.88971 int8
/model.13/Resize BPU id(0) HzQuantizedResizeUpsample 0.983083 4.81467 int8
/model.13/Resize_output_0_calibrated_Requantize BPU id(0) HzRequantize – – int8
…el.4/cv2/act/Mul_output_0_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.14/Concat BPU id(0) Concat 0.984969 4.81467 int8
/model.15/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.992850 4.14975 int8
/model.15/cv1/act/Mul BPU id(0) HzLut 0.993870 6.30765 int8
/model.15/Split BPU id(0) Split 0.988977 2.93748 int8
/model.15/m.0/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.992879 2.93748 int8
/model.15/m.0/cv1/act/Mul BPU id(0) HzLut 0.990125 5.021 int8
/model.15/m.0/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.989580 2.31791 int8
/model.15/m.0/cv2/act/Mul BPU id(0) HzLut 0.993056 5.5557 int8
/model.15/Split_output_0_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.15/Split_output_1_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.15/Concat BPU id(0) Concat 0.993438 2.93748 int8
/model.15/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.992210 4.46321 int8
/model.15/cv2/act/Mul BPU id(0) HzLut 0.992267 6.09916 int8
/model.16/conv/Conv BPU id(0) HzSQuantizedConv 0.988701 3.92067 int8
/model.22/cv2.0/cv2.0.0/conv/Conv BPU id(0) HzSQuantizedConv 0.988758 3.92067 int8
/model.22/cv3.0/cv3.0.0/conv/Conv BPU id(0) HzSQuantizedConv 0.981332 3.92067 int8
/model.16/act/Mul BPU id(0) HzLut 0.982522 6.16259 int8
/model.22/cv2.0/cv2.0.0/act/Mul BPU id(0) HzLut 0.984308 8.49597 int8
/model.22/cv3.0/cv3.0.0/act/Mul BPU id(0) HzLut 0.978545 6.39436 int8
/model.17/Concat BPU id(0) Concat 0.982861 4.81467 int8
/model.22/cv2.0/cv2.0.1/conv/Conv BPU id(0) HzSQuantizedConv 0.986237 5.26952 int8
/model.22/cv3.0/cv3.0.1/conv/Conv BPU id(0) HzSQuantizedConv 0.984597 5.5214 int8
/model.18/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.986413 4.81467 int8
/model.22/cv2.0/cv2.0.1/act/Mul BPU id(0) HzLut 0.986819 20.0159 int8
/model.22/cv3.0/cv3.0.1/act/Mul BPU id(0) HzLut 0.985793 8.44081 int8
/model.18/cv1/act/Mul BPU id(0) HzLut 0.981293 6.49756 int8
/model.22/cv2.0/cv2.0.2/Conv BPU id(0) HzSQuantizedConv 0.990910 19.4194 int8
/model.22/cv3.0/cv3.0.2/Conv BPU id(0) HzSQuantizedConv 0.999448 8.37818 int8
/model.18/Split BPU id(0) Split 0.970992 4.96917 int8
/model.18/m.0/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.990424 4.96917 int8
/model.18/m.0/cv1/act/Mul BPU id(0) HzLut 0.985177 6.37805 int8
/model.18/m.0/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.979504 3.42796 int8
/model.18/m.0/cv2/act/Mul BPU id(0) HzLut 0.975203 10.3212 int8
/model.18/Split_output_0_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.18/Split_output_1_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.18/Concat BPU id(0) Concat 0.977591 4.96917 int8
/model.18/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.987361 7.21077 int8
/model.18/cv2/act/Mul BPU id(0) HzLut 0.983778 9.31555 int8
/model.19/conv/Conv BPU id(0) HzSQuantizedConv 0.987526 4.26326 int8
/model.22/cv2.1/cv2.1.0/conv/Conv BPU id(0) HzSQuantizedConv 0.983575 4.26326 int8
/model.22/cv3.1/cv3.1.0/conv/Conv BPU id(0) HzSQuantizedConv 0.976600 4.26326 int8
/model.19/act/Mul BPU id(0) HzLut 0.971063 7.97608 int8
/model.22/cv2.1/cv2.1.0/act/Mul BPU id(0) HzLut 0.983002 14.1845 int8
/model.22/cv3.1/cv3.1.0/act/Mul BPU id(0) HzLut 0.976541 8.45732 int8
/model.20/Concat BPU id(0) Concat 0.979784 4.43933 int8
/model.22/cv2.1/cv2.1.1/conv/Conv BPU id(0) HzSQuantizedConv 0.988803 7.72667 int8
/model.22/cv3.1/cv3.1.1/conv/Conv BPU id(0) HzSQuantizedConv 0.983007 7.62087 int8
/model.21/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.986442 4.43933 int8
/model.22/cv2.1/cv2.1.1/act/Mul BPU id(0) HzLut 0.988968 22.3114 int8
/model.22/cv3.1/cv3.1.1/act/Mul BPU id(0) HzLut 0.983587 14.3788 int8
/model.21/cv1/act/Mul BPU id(0) HzLut 0.976965 9.6443 int8
/model.22/cv2.1/cv2.1.2/Conv BPU id(0) HzSQuantizedConv 0.992698 22.1627 int8
/model.22/cv3.1/cv3.1.2/Conv BPU id(0) HzSQuantizedConv 0.999004 14.0453 int8
/model.21/Split BPU id(0) Split 0.971172 5.49813 int8
/model.21/m.0/cv1/conv/Conv BPU id(0) HzSQuantizedConv 0.990244 5.49813 int8
/model.21/m.0/cv1/act/Mul BPU id(0) HzLut 0.975875 8.72303 int8
/model.21/m.0/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.982620 5.67331 int8
/model.21/m.0/cv2/act/Mul BPU id(0) HzLut 0.975880 12.0848 int8
/model.21/Split_output_0_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.21/Split_output_1_calibrated_Requantize BPU id(0) HzRequantize – – int8
/model.21/Concat BPU id(0) Concat 0.976020 5.49813 int8
/model.21/cv2/conv/Conv BPU id(0) HzSQuantizedConv 0.989450 8.53894 int8
/model.21/cv2/act/Mul BPU id(0) HzLut 0.976016 14.9993 int8
/model.22/cv2.2/cv2.2.0/conv/Conv BPU id(0) HzSQuantizedConv 0.989705 5.28644 int8
/model.22/cv3.2/cv3.2.0/conv/Conv BPU id(0) HzSQuantizedConv 0.982606 5.28644 int8
/model.22/cv2.2/cv2.2.0/act/Mul BPU id(0) HzLut 0.986526 11.5501 int8
/model.22/cv3.2/cv3.2.0/act/Mul BPU id(0) HzLut 0.979600 10.3133 int8
/model.22/cv2.2/cv2.2.1/conv/Conv BPU id(0) HzSQuantizedConv 0.990666 9.45998 int8
/model.22/cv3.2/cv3.2.1/conv/Conv BPU id(0) HzSQuantizedConv 0.983940 9.61694 int8
/model.22/cv2.2/cv2.2.1/act/Mul BPU id(0) HzLut 0.991346 20.9386 int8
/model.22/cv3.2/cv3.2.1/act/Mul BPU id(0) HzLut 0.985166 17.8943 int8
/model.22/cv2.2/cv2.2.2/Conv BPU id(0) HzSQuantizedConv 0.995579 20.7491 int8
/model.22/cv3.2/cv3.2.2/Conv BPU id(0) HzSQuantizedConv 0.997589 17.6595 int8
2026-04-19 14:16:00,852 INFO The quantized model output:

Output Cosine Similarity L1 Distance L2 Distance Chebyshev Distance

output0 0.999448 0.492888 0.003710 5.550701
325 0.990910 99.219258 0.223257 1460.238770
344 0.999004 0.564130 0.009112 7.719759
343 0.992697 95.437490 0.436282 1224.302979
362 0.997589 0.781466 0.028093 10.940637
361 0.995579 72.649756 0.666174 944.549194
2026-04-19 14:16:00,860 INFO End to Horizon NN Model Convert.
2026-04-19 14:16:00,881 INFO start convert to *.bin file…
2026-04-19 14:16:00,899 INFO ONNX model output num : 6
2026-04-19 14:16:00,903 INFO ############# model deps info #############
2026-04-19 14:16:00,903 INFO hb_mapper version : 1.24.3
2026-04-19 14:16:00,904 INFO hbdk version : 3.49.15
2026-04-19 14:16:00,904 INFO hbdk runtime version: 3.15.55.0
2026-04-19 14:16:00,905 INFO horizon_nn version : 1.1.0
2026-04-19 14:16:00,906 INFO ############# model_parameters info #############
2026-04-19 14:16:00,907 INFO onnx_model : /data/best.onnx
2026-04-19 14:16:00,907 INFO BPU march : bayes-e
2026-04-19 14:16:00,908 INFO layer_out_dump : False
2026-04-19 14:16:00,908 INFO log_level : DEBUG
2026-04-19 14:16:00,909 INFO working dir : /data/model_output
2026-04-19 14:16:00,910 INFO output_model_file_prefix: yolov8_cow
2026-04-19 14:16:00,910 INFO ############# input_parameters info #############
2026-04-19 14:16:00,911 INFO ------------------------------------------
2026-04-19 14:16:00,912 INFO ---------input info : images ---------
2026-04-19 14:16:00,912 INFO input_name : images
2026-04-19 14:16:00,913 INFO input_type_rt : nv12
2026-04-19 14:16:00,914 INFO input_space&range : regular
2026-04-19 14:16:00,914 INFO input_layout_rt : None
2026-04-19 14:16:00,915 INFO input_type_train : rgb
2026-04-19 14:16:00,915 INFO input_layout_train : NCHW
2026-04-19 14:16:00,915 INFO norm_type : data_scale
2026-04-19 14:16:00,916 INFO input_shape : 1x3x640x640
2026-04-19 14:16:00,916 INFO scale_value : 0.003921568627451,
2026-04-19 14:16:00,917 INFO cal_data_dir : /data/cal_bin
2026-04-19 14:16:00,919 INFO cal_data_type : float32
2026-04-19 14:16:00,919 INFO ---------input info : images end -------
2026-04-19 14:16:00,920 INFO ------------------------------------------
2026-04-19 14:16:00,921 INFO ############# calibration_parameters info #############
2026-04-19 14:16:00,923 INFO preprocess_on : False
2026-04-19 14:16:00,924 INFO calibration_type: : default
2026-04-19 14:16:00,926 INFO per_channel : False
2026-04-19 14:16:00,927 INFO ############# compiler_parameters info #############
2026-04-19 14:16:00,929 INFO debug : False
2026-04-19 14:16:00,932 INFO compile_mode : latency
2026-04-19 14:16:00,933 INFO hbdk_pass_through_params: --O3 --core-num 1 --fast
2026-04-19 14:16:00,934 INFO input-source : {‘images’: ‘pyramid’, ‘_default_value’: ‘ddr’}
2026-04-19 14:16:00,988 INFO Convert to runtime bin file successfully!
2026-04-19 14:16:00,989 INFO End Model Convert
tros运行报错日志如下:root@ubuntu:/home/sunrise/yolov8# ros2 launch dnn_node_example dnn_node_example_feedback.launch.py dnn_example_config_file:=my_config/yolov8workconfig.json dnn_example_image:=my_config/target.jpg
[INFO] [launch]: All log files can be found below /root/.ros/log/2026-04-19-14-18-07-737392-ubuntu-96260
[INFO] [launch]: Default logging verbosity is set to INFO
dnn_node_example_path is /opt/tros/humble/lib/dnn_node_example
cp_cmd is cp -r /opt/tros/humble/lib/dnn_node_example/config .
[INFO] [example-1]: process started with pid [96275]
[example-1] [WARN] [1776579488.344130468] [dnn_example_node]: Parameter:
[example-1] feed_type(0:local, 1:sub): 0
[example-1] image: my_config/target.jpg
[example-1] image_type: 0
[example-1] dump_render_img: 1
[example-1] is_shared_mem_sub: 0
[example-1] config_file: my_config/yolov8workconfig.json
[example-1] msg_pub_topic_name: hobot_dnn_detection
[example-1] info_msg_pub_topic_name: hobot_dnn_detection_info
[example-1] ros_img_topic_name: /image
[example-1] sharedmem_img_topic_name: /hbmem_img
[example-1] [WARN] [1776579488.344750178] [dnn_example_node]: Load [5] class types from file [my_config/cow.list]
[example-1] [WARN] [1776579488.344876012] [dnn_example_node]: Parameter:
[example-1] model_file_name: /home/sunrise/yolov8/cow9.bin
[example-1] model_name:
[example-1] [INFO] [1776579488.344957595] [dnn]: Node init.
[example-1] [INFO] [1776579488.344981679] [dnn_example_node]: Set node para.
[example-1] [WARN] [1776579488.345021220] [dnn_example_node]: model_file_name_: /home/sunrise/yolov8/cow9.bin, task_num: 4
[example-1] [INFO] [1776579488.345067762] [dnn]: Model init.
[example-1] [BPU_PLAT]BPU Platform Version(1.3.6)! soc info(x5)
[example-1] [HBRT] set log level as 0. version = 3.15.55.0
[example-1] [DNN] Runtime version = 1.24.5_(3.15.55 HBRT)
[example-1] [A][DNN][packed_model.cpp:247]Model [HorizonRT] The model builder version = 1.24.3
[example-1] [INFO] [1776579488.546565582] [dnn]: The model input 0 width is 640 and height is 640
[example-1] [INFO] [1776579488.546734249] [dnn]:
[example-1] Model Info:
[example-1] name: yolov8_cow.
[example-1] [input]
[example-1] - (0) Layout: NCHW, Shape: [1, 3, 640, 640], Type: HB_DNN_IMG_TYPE_NV12.
[example-1] [output]
[example-1] - (0) Layout: NHWC, Shape: [1, 80, 80, 5], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (1) Layout: NHWC, Shape: [1, 80, 80, 64], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (2) Layout: NHWC, Shape: [1, 40, 40, 5], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (3) Layout: NHWC, Shape: [1, 40, 40, 64], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (4) Layout: NHWC, Shape: [1, 20, 20, 5], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1] - (5) Layout: NHWC, Shape: [1, 20, 20, 64], Type: HB_DNN_TENSOR_TYPE_F32.
[example-1]
[example-1] [INFO] [1776579488.546788582] [dnn]: Task init.
[example-1] [INFO] [1776579488.548508462] [dnn]: Set task_num [4]
[example-1] [WARN] [1776579488.548589795] [dnn_example_node]: Get model name: yolov8_cow from load model.
[example-1] [INFO] [1776579488.548707837] [dnn_example_node]: The model input width is 640 and height is 640
[example-1] [WARN] [1776579488.548766879] [dnn_example_node]: Create ai msg publisher with topic_name: hobot_dnn_detection
[example-1] [INFO] [1776579488.562131706] [dnn_example_node]: Dnn node feed with local image: my_config/target.jpg
[example-1] [INFO] [1776579488.621204861] [dnn_example_node]: Output from frame_id: feedback, stamp: 0.0
[example-1] [ERROR] [1776579488.621392569] [dnn_example_node]: Inlvaid parser: 0
^C[WARNING] [launch]: user interrupted with ctrl-c (SIGINT)
[example-1] [INFO] [1776579694.396430972] [rclcpp]: signal_handler(signum=2)
[INFO] [example-1]: process has finished cleanly [pid 96275]

你好!问题已经非常清楚了!:bullseye:

核心问题定位

从你提供的日志对比,我发现了关键差异:

特性 官方 YOLOv5 你的 YOLOv8
输出数量 3 个 6 个
输出类型 全 S32 + SCALE 全 F32 + NONE
输出结构 cls+bbox 合并 cls+bbox 分离

根本原因:TROS 的 yolov8 parser 期望 bbox 分支是 S32 + SCALE,但 hb_mapper PTQ 流程默认不量化输出层,导致全是 F32 + NONE。


解决方案(按优先级)

方案一:使用社区验证的 YOLOv8 导出脚本(最推荐)

rdk_model_zoo 中有专门针对 YOLOv8 的导出脚本,会自动处理输出量化。

# 1. 获取 rdk_model_zoo
git clone https://github.com/D-Robotics/rdk_model_zoo.git
cd rdk_model_zoo/demos/detect

# 2. 查找 YOLOv8 相关脚本
ls -la | grep -i yolov8

# 3. 如果没有,参考 YOLOv5 的导出方式
# 关键:在 ONNX 中添加 FakeQuantize 节点

如果目录中没有 YOLOv8,参考这个帖子中的导出脚本:


方案二:在 ONNX 中添加 FakeQuantize 节点

需要在导出 ONNX 时,对 bbox 分支添加伪量化节点,让 hb_mapper 识别为需要量化的输出:

import torch
import torch.nn as nn

class FakeQuantize(nn.Module):
    def __init__(self, scale=255.0):
        super().__init__()
        self.scale = scale
    
    def forward(self, x):
        # 模拟反量化:保持 float32 但让 hb_mapper 识别为需要量化
        return torch.round(x * self.scale) / self.scale

def bpu_detect_forward(self, x):
    result = []
    for i in range(self.nl):
        bbox = self.cv2[i](x[i])
        cls = self.cv3[i](x[i])
        
        # 关键:对 bbox 添加 FakeQuantize
        bbox = FakeQuantize(255.0)(bbox)
        
        bbox = bbox.permute(0, 2, 3, 1).contiguous()
        cls = cls.permute(0, 2, 3, 1).contiguous()
        
        result.append(cls)
        result.append(bbox)
    return result

方案三:修改 TROS 配置文件(临时方案)

尝试在 yolov8workconfig.json 中添加输出类型配置:

{
  "model_file": "/home/sunrise/yolov8/cow9.bin",
  "task_num": 4,
  "dnn_parser": "yolov8",
  "model_output_count": 6,
  "reg_max": 16,
  "class_num": 5,
  "cls_names_list": "my_config/cow.list",
  "strides": [8, 16, 32],
  "score_threshold": 0.25,
  "nms_threshold": 0.7,
  "nms_top_k": 300,
  "output_order": [0, 1, 2, 3, 4, 5],
  "output_type": ["F32", "F32", "F32", "F32", "F32", "F32"]
}

方案四:使用 Python 推理(绕过 TROS parser)

如果 TROS parser 始终无法兼容,可以直接使用 hobot_dnn Python 接口进行推理和后处理:

from hobot_dnn import pyeasy_dnn as dnn
import numpy as np

# 加载模型
models = dnn.load('/home/sunrise/yolov8/cow9.bin')
model = models[0]

# 推理
outputs = model.inference(input_image)

# 手动后处理(参考官方 YOLOv8 后处理代码)
# 解码 bbox + NMS

快速验证步骤

1. 先确认官方 YOLOv8 模型是否存在

# 检查板子上是否有官方 YOLOv8 模型
ls /opt/hobot/model/x5/basic/ | grep -i yolov8

# 如果有,测试官方模型
hrt_model_exec model_info --model_file=/opt/hobot/model/x5/basic/yolov8_640x640_nv12.bin | head -50

2. 对比输出类型

如果官方 YOLOv8 模型输出也是 F32,说明 TROS parser 应该支持 F32,问题可能在配置文件。

3. 检查 TROS 版本

# 查看 TROS 版本
ros2 pkg prefix dnn_node_example

# 查看 dnn_node_example 源码中的 parser 实现
find /opt/tros -name "*yolov8*parser*" -o -name "*parser*yolov8*"

建议下一步

  1. 优先检查板子上是否有官方 YOLOv8 模型,对比输出类型
  2. 如果没有:在社区发帖求助,附上你的完整日志和导出脚本
  3. 如果急需解决:使用方案四(Python 推理),绕过 TROS parser

相关资源

先把官方 YOLOv8 模型的情况确认一下,如果板子上没有,建议直接在社区发帖求助,这个问题可能需要官方支持!:rocket:

你好,可以参考我的帖子 使用 uyltralytics_yolo dnn_parser

你用YOLOv8怎么能用 yolo26 导出ONNX脚本呀,需要参考对应的 rdk_model_zoo/samples/vision/ultralytics_yolo/conversion/README_cn.md at rdk_x5 · D-Robotics/rdk_model_zoo · GitHub

请问一下你是怎么解决的呀,我的问题和你一模一样

你好!看到 wzm1809434 也遇到了同样的问题。这个问题确实很典型,我来总结一下最终解决方案:

核心问题

YOLOv8 部署到 RDK X5 时,hb_mapper PTQ 流程默认不量化输出层,导致:

  • 所有输出都是 F32 + NONE
  • 但 TROS 的 yolov8 parser 期望 bbox 分支是 S32 + SCALE

正确解决方案

步骤 1:使用 rdk_model_zoo 官方的 YOLOv8 导出脚本

不要自己修改导出脚本,直接使用社区验证过的:

# 1. 克隆 rdk_model_zoo
git clone -b rdk_x5 https://github.com/D-Robotics/rdk_model_zoo.git
cd rdk_model_zoo/samples/vision/ultralytics_yolo/conversion

# 2. 查看导出脚本
ls -la
# 找到 export_yolo26_detect_bpu.py 或类似脚本

关键:YOLOv8 在 Ultralytics 框架中也被称为 YOLOv26,所以要用 ultralytics_yolo 相关的导出脚本,而不是 yolov5 的。


步骤 2:正确的导出流程

# 1. 训练你的 YOLOv8 模型(5 分类)
yolo task=detect mode=train model=yolov8n.pt data=your_data.yaml epochs=100 imgsz=640

# 2. 使用官方导出脚本(关键!)
cd rdk_model_zoo/samples/vision/ultralytics_yolo/conversion/onnx_export
python export_yolo26_detect_bpu.py \
  --weights /path/to/your/best.pt \
  --imgsz 640 \
  --opset 11

# 3. 验证 ONNX 输出(应该全是 F32,这是正常的)
python3 -c "
import onnx
model = onnx.load('yolo26_det_bpu.onnx')
for output in model.graph.output:
    shape = [d.dim_value for d in output.type.tensor_type.shape.dim]
    print(f'{output.name}: shape={shape}')
"

步骤 3:正确的 hb_mapper YAML 配置

model_parameters:
  onnx_model: './yolo26_det_bpu.onnx'
  march: "bayes-e"
  layer_out_dump: False
  working_dir: 'model_output'
  output_model_file_prefix: 'yolov8_cow'

input_parameters:
  input_name: "images"
  input_type_rt: 'nv12'
  input_type_train: 'rgb'
  input_layout_train: 'NCHW'
  norm_type: 'data_scale'
  scale_value: 0.003921568627451

calibration_parameters:
  cal_data_dir: './cal_bin'
  cal_data_type: 'float32'
  calibration_type: 'default'

compiler_parameters:
  compile_mode: 'latency'
  debug: False
  optimize_level: 'O3'

注意:

  • layer_out_dump: False(不要输出中间层)
  • 不要添加 optimization_parameters(1.24.3 版本不支持)

步骤 4:编译并验证

# 1. 编译
hb_mapper makertbin --model-type onnx --config yolov8.yaml

# 2. 验证模型输出
hrt_model_exec model_info --model_file=./model_output/yolov8_cow.bin

# 期望输出(6 个输出,bbox 应该是 S32):
# output[0]: shape=(1,80,80,5), type=F32   # cls_P3
# output[1]: shape=(1,80,80,64), type=S32  # bbox_P3 ✓
# output[2]: shape=(1,40,40,5), type=F32   # cls_P4
# output[3]: shape=(1,40,40,64), type=S32  # bbox_P4 ✓
# output[4]: shape=(1,20,20,5), type=F32   # cls_P5
# output[5]: shape=(1,20,20,64), type=S32  # bbox_P5 ✓

步骤 5:TROS 配置

{
  "model_file": "/home/sunrise/yolov8/yolov8_cow.bin",
  "task_num": 4,
  "dnn_parser": "yolov8",
  "model_output_count": 6,
  "reg_max": 16,
  "class_num": 5,
  "cls_names_list": "my_config/cow.list",
  "strides": [8, 16, 32],
  "score_threshold": 0.25,
  "nms_threshold": 0.7,
  "nms_top_k": 300,
  "output_order": [0, 1, 2, 3, 4, 5]
}

如果还是不行

备选方案:使用 Python 推理

如果 TROS parser 始终无法兼容,可以直接用 Python 推理:

from hobot_dnn import pyeasy_dnn as dnn
import numpy as np

# 加载模型
models = dnn.load('/home/sunrise/yolov8/yolov8_cow.bin')
model = models[0]

# 推理
outputs = model.inference(input_image)

# 手动后处理
# 1. 解码 bbox(output[1], [3], [5])
# 2. 获取 cls(output[0], [2], [4])
# 3. NMS

关键差异总结

操作 错误做法 正确做法
导出脚本 自己修改 Detect_forward 用 rdk_model_zoo 官方脚本
输出量化 在 PyTorch 中转 int32 让 hb_mapper 自动处理
YAML 配置 添加 cal_data_count 等无效参数 只用标准参数
layer_out_dump True(导致 69 个输出) False(只有 6 个输出)

相关资源


给 wzm1809434 的建议

你的问题和 huajinxhr 完全一样,直接按上述步骤操作即可。最关键的是使用 rdk_model_zoo 官方的导出脚本,不要自己修改 Detect_forward 函数。

如果还有问题,建议:

  1. 把 hrt_model_exec model_info 的输出发出来
  2. 确认输出数量是 6 个(不是 69 个)
  3. 确认 bbox 分支是 S32(不是 F32)

祝顺利!:rocket: