专栏算法工具链onnx模型转换checker报错 No quantifiable nodes were found

onnx模型转换checker报错 No quantifiable nodes were found

已解决
蘼芜秋兰2021-05-07
195
4

编辑:

之前没有发现工具链有更新,现在用新版的工具链(hbdk version 3.18.2 horizon_nn version 0.9.10 hb_mapper version 1.2.6)尝试了一下,简单的模型已经能够顺利转换了(op10),但是我们想要部署的模型(op11)仍然会出现以下报错:

ERROR HorizonRT not support these cpu operators: Where Gather Expand ScatterND

原始内容:

我在使用模型转换工具链转换onnx模型时出现报错No quantifiable nodes were found。起初以为是模型的问题,就先生成了一个更为简单的模型进行测试,但还是出现同样的报错,我在论坛上也没有搜索到类似的情况。请问可能是什么原因?

另外,请问,现在版本的模型转换工具链是否支持onnx opset_version=11?我们想要部署的模型在转换成onnx opset_version=10会有一些问题。

报错信息

log记录更详细信息:

2021-05-07 11:36:48,904 INFO hb_mapper_checker 67 Model type: onnx

2021-05-07 11:36:48,905 DEBUG hb_mapper_checker 68 march: bernoulli2

2021-05-07 11:36:48,905 INFO hb_mapper_checker 69 output file: ./playplay_checker.log

2021-05-07 11:36:48,907 INFO hb_mapper_checker 74 input names []

2021-05-07 11:36:48,907 INFO hb_mapper_checker 75 input shapes {}

2021-05-07 11:36:48,911 INFO hb_mapper_checker 81 Begin model checking....

2021-05-07 11:36:48,914 INFO build 36 [Fri May 7 11:36:48 2021] Start to Horizon NN Model Convert.

2021-05-07 11:36:48,915 INFO build 162 The input parameter is not specified, convert with default parameters.

2021-05-07 11:36:48,917 INFO build 346 The hbdk parameter is not specified, and the submodel will be compiled with the default parameter.

2021-05-07 11:36:48,921 INFO build 137 HorizonNN version: 0.9.7

2021-05-07 11:36:48,922 INFO build 141 HBDK version: 3.16.6

2021-05-07 11:36:48,923 INFO build 36 [Fri May 7 11:36:48 2021] Start to parse the onnx model.

2021-05-07 11:36:48,942 INFO onnx_parser 101 ONNX model info:

ONNX IR version: 6

Opset version: 10

Input name: 0, [25, 3]

2021-05-07 11:36:48,957 INFO build 39 [Fri May 7 11:36:48 2021] End to parse the onnx model.

2021-05-07 11:36:48,959 INFO build 457 Model input names: ['0']

2021-05-07 11:36:48,986 INFO build 821 Saving the original float model: ./.hb_check/original_float_model.onnx.

2021-05-07 11:36:48,987 INFO build 36 [Fri May 7 11:36:48 2021] Start to optimize the model.

2021-05-07 11:36:49,006 INFO build 39 [Fri May 7 11:36:49 2021] End to optimize the model.

2021-05-07 11:36:49,022 INFO build 832 Saving the optimized model: ./.hb_check/optimized_float_model.onnx.

2021-05-07 11:36:49,023 INFO build 36 [Fri May 7 11:36:49 2021] Start to calibrate the model.

2021-05-07 11:36:49,030 DEBUG tool_utils 95 exception in checker

2021-05-07 11:36:49,037 DEBUG tool_utils 96 Traceback (most recent call last):

File "/root/.local/lib/python3.6/site-packages/x3_tc_ui/utils/tool_utils.py", line 93, in __decorator

func(*args, **kargs)

File "/root/.local/lib/python3.6/site-packages/x3_tc_ui/hb_mapper.py", line 69, in checker

input_shape).run(version)

File "/root/.local/lib/python3.6/site-packages/x3_tc_ui/hb_mapper_checker.py", line 97, in run

**addtional_param)

File "/root/.local/lib/python3.6/site-packages/horizon_nn/build.py", line 1167, in check_onnx

return builder.build_model(original_model, save_model)

File "/root/.local/lib/python3.6/site-packages/horizon_nn/build.py", line 835, in build_model

calibration_table = self.model_calibration(optimized_model)

File "/root/.local/lib/python3.6/site-packages/horizon_nn/build.py", line 710, in model_calibration

optimized_model, self.march, "", self.node_dict)

File "/root/.local/lib/python3.6/site-packages/horizon_nn/horizon_onnx/quantizer.py", line 206, in create_pre_calibrated_model

node_dict)

horizon_nn.horizon_onnx.onnx_cpp2py_export.checker.ValidationError: No quantifiable nodes were found, and the model is not supported.

2021-05-07 11:36:49,037 ERROR tool_utils 97 No quantifiable nodes were found, and the model is not supported.

2021-05-07 11:36:49,038 INFO build 39 [Fri May 7 11:36:49 2021] End to calibrate the model.

2021-05-07 11:36:49,046 INFO build 39 [Fri May 7 11:36:49 2021] End to Horizon NN Model Convert.

使用Netron查看onnx模型信息如下:

使用Netron查看checker优化后onnx模型信息如下(./.hb_check/optimized_float_model.onnx.):

算法工具链
评论2
0/1000
  • 芯链情报局
    Lv.4

    你好,问题回复如下哈:

    不支持的 CPU 算子:Where Gather Expand ScatterND

    因为我们的芯片支持异构模型,所以对于不支持 BPU 加速的算子,我们会运行在 CPU 上。以上算子就是只能在 CPU 上运行,而且暂时还没有做开发。目前已经支持的情况可以参考下我们的算子支持列表

    No quantifiable nodes were found

    该报错是因为对于模型量化,是需要有 Conv 这样的可量化算子的,以上提供的 2 个模型,都是不包含参数的算子,比如 reshape、slice 等

    是否支持 opset11

    目前我们主力支持是 opset10,opset11 也基本支持,再高的版本不支持

    2021-05-07
    0
    2
    • 蘼芜秋兰回复芯链情报局:

      好的!谢谢你们的回复!新版本的工具链比之前好用很多,目前这个帖子的问题已经解决了。

      我想再请教一个问题,还是关于模型转换的。配置makertbin的yaml文件时,需要制定输入类型和进行校准。我们的模型输入并非图片,而是一个三维数组,我不确定应该对应哪种input type (rgbp/bgrp/gray/featuremap/yuv444_128),也不清楚如何准备校准数据。如果不进行校准,能否输出能上板运行的模型,会有哪些缺陷?

      另外,我感觉目前提供的例子几乎都是图片输入的,也希望能有一些非图片输入的例子。谢谢了!

      2021-05-08
      0
    • 芯链情报局回复蘼芜秋兰:

      你好,目前我们的芯片暂时只支持 4 维输入,3 维输入暂不支持。

      对于非图片输入的模型,我们可以当作一个特征输入,所以应该配置为 featuremap,校准数据准备就是模型输入大小的一个 float32 的数据即可,保存为二进制文件。

      参考示例目录在 sample/05_miscellaneous/02_resnet50_feature

      2021-05-10
      0
  • admin
    Lv.1
    您先,问题已经收到,我们会尽快给您解决。
    op11在最新版的工具链中已经可以使用,请到资料下载中更新使用,有问题,请您继续提出,我们会协助解决。
    2021-05-07
    0
    0