专栏算法工具链resizer模型转换遇到no enough memory for hbm infer

resizer模型转换遇到no enough memory for hbm infer

已解决
lvjj2023-02-15
58
9

在使用转换工具链的时候遇到了模型无法转成为resizer模型的情况,转换log如下

[root@cfb8ae34a3bc mapper]# bash 03_build.sh

cd $(dirname $0)

config_file="./ocr_config.yaml"

model_type="onnx"

# build model

hb_mapper makertbin --config ${config_file} \

--model-type ${model_type}

/usr/local/lib/python3.6/site-packages/paramiko/transport.py:33: CryptographyDeprecationWarning: Python 3.6 is no longer supported by the Python core team. Therefore, support for it is deprecated in cryptography and will be removed in a future release.

from cryptography.hazmat.backends import default_backend

2023-02-15 11:20:54,282 INFO log will be stored in /horizon_model_convert_sample/08_opendrive/03_lprnet/mapper/hb_mapper_makertbin.log

2023-02-15 11:20:54,282 INFO Start hb_mapper....

2023-02-15 11:20:54,282 INFO hbdk version 3.42.1

2023-02-15 11:20:54,282 INFO horizon_nn version 0.15.7

2023-02-15 11:20:54,282 INFO hb_mapper version 1.13.3

2023-02-15 11:20:54,283 INFO Start Model Convert....

2023-02-15 11:20:54,293 INFO Using onnx model file: /horizon_model_convert_sample/08_opendrive/onnx_model/lprnet_20230131_1x3x32x96_sim.onnx

2023-02-15 11:20:54,297 INFO Model has 1 inputs according to model file

2023-02-15 11:20:54,298 INFO Model name not given in yaml_file, using model name from model file: ['input']

2023-02-15 11:20:54,298 INFO Model input shape not given in yaml_file, using shape from model file: [[1, 3, 32, 96]]

2023-02-15 11:20:54,298 INFO nv12 input type rt received.

2023-02-15 11:20:54,298 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

2023-02-15 11:20:54,298 INFO custom_op does not exist, skipped

2023-02-15 11:20:54,301 INFO *******************************************

2023-02-15 11:20:54,301 INFO First calibration picture name: 0.bin

2023-02-15 11:20:54,301 INFO First calibration picture md5:

9e58c897c8781fbf98aac67ec65f0226 /horizon_model_convert_sample/08_opendrive/03_lprnet/mapper/quant_data/0.bin

2023-02-15 11:20:54,304 INFO *******************************************

2023-02-15 11:20:54,410 INFO [Wed Feb 15 11:20:54 2023] Start to Horizon NN Model Convert.

2023-02-15 11:20:54,410 INFO Parsing the input parameter:{'input': {'input_shape': [1, 3, 32, 96], 'input_batch': 8, 'expected_input_type': 'YUV444_128', 'original_input_type': 'BGR', 'original_input_layout': 'NCHW', 'scales': array([0.00390625], dtype=float32)}}

2023-02-15 11:20:54,410 INFO Parsing the calibration parameter

2023-02-15 11:20:54,410 INFO Parsing the hbdk parameter:{'hbdk_pass_through_params': '--O0 --core-num 1 --fast ', 'input-source': {'input': 'resizer', '_default_value': 'ddr'}}

2023-02-15 11:20:54,410 INFO HorizonNN version: 0.15.7

2023-02-15 11:20:54,410 INFO HBDK version: 3.42.1

2023-02-15 11:20:54,410 INFO [Wed Feb 15 11:20:54 2023] Start to parse the onnx model.

2023-02-15 11:20:54,415 INFO Input ONNX model infomation:

ONNX IR version: 5

Opset version: [10]

Producer: pytorch1.12.1

Domain: none

Input name: input, [1, 3, 32, 96]

Output name: output, [1, 70, 1, 22]

2023-02-15 11:20:54,438 INFO [Wed Feb 15 11:20:54 2023] End to parse the onnx model.

2023-02-15 11:20:54,438 INFO Model input names parsed from model: ['input']

2023-02-15 11:20:54,439 INFO Create a preprocessing operator for input_name input with means=None, std=[256.], original_input_layout=NCHW, color convert from 'BGR' to 'YUV_BT601_FULL_RANGE'.

2023-02-15 11:20:54,460 INFO Saving the original float model: lprnet_20230209_1x3x32x96_sim_original_float_model.onnx.

2023-02-15 11:20:54,460 INFO [Wed Feb 15 11:20:54 2023] Start to optimize the model.

2023-02-15 11:20:54,619 INFO [Wed Feb 15 11:20:54 2023] End to optimize the model.

2023-02-15 11:20:54,624 INFO Saving the optimized model: lprnet_20230209_1x3x32x96_sim_optimized_float_model.onnx.

2023-02-15 11:20:54,624 INFO [Wed Feb 15 11:20:54 2023] Start to calibrate the model.

2023-02-15 11:20:54,624 INFO There are 100 samples in the calibration data set.

2023-02-15 11:20:54,657 INFO Run calibration model with default calibration method.

Default calibration in progress: 100%|████████████████████████████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.82it/s]

2023-02-15 11:20:58,519 WARNING got unexpected output threshold on conv Conv_2! value: 7.66673e-40

2023-02-15 11:20:58,519 WARNING got unexpected input threshold on conv Conv_3! value: 7.66673e-40

2023-02-15 11:20:58,520 WARNING got unexpected output threshold on conv Conv_3! value: 3.1909e-41

2023-02-15 11:20:58,520 WARNING got unexpected input threshold on conv Conv_5! value: 3.1909e-41

2023-02-15 11:20:58,520 WARNING got unexpected output threshold on conv Conv_5! value: 3.45056e-41

2023-02-15 11:20:58,520 WARNING got unexpected input threshold on conv Conv_7! value: 3.45056e-41

2023-02-15 11:20:58,520 WARNING got unexpected output threshold on conv Conv_7! value: 3.50255e-41

2023-02-15 11:20:58,520 WARNING got unexpected input threshold on conv Conv_9! value: 3.50255e-41

2023-02-15 11:20:58,520 WARNING got unexpected output threshold on conv Conv_9! value: 3.39689e-41

2023-02-15 11:20:58,520 WARNING got unexpected input threshold on conv Conv_11! value: 3.39689e-41

2023-02-15 11:20:58,521 WARNING got unexpected output threshold on conv Conv_11! value: 3.49904e-41

2023-02-15 11:20:58,521 WARNING got unexpected input threshold on conv Conv_12! value: 3.49904e-41

2023-02-15 11:20:58,521 WARNING got unexpected output threshold on conv Conv_12! value: 3.48937e-41

2023-02-15 11:20:58,521 WARNING got unexpected input threshold on conv Conv_14! value: 3.48937e-41

2023-02-15 11:20:58,521 WARNING got unexpected output threshold on conv Conv_14! value: 3.14087e-41

2023-02-15 11:20:58,521 WARNING got unexpected input threshold on conv Conv_16! value: 3.14087e-41

2023-02-15 11:20:58,521 WARNING got unexpected output threshold on conv Conv_16! value: 0

2023-02-15 11:20:58,521 WARNING got unexpected input threshold on conv Conv_18! value: 0

2023-02-15 11:20:58,522 WARNING got unexpected output threshold on conv Conv_18! value: 0

2023-02-15 11:20:58,522 WARNING got unexpected input threshold on conv Conv_20! value: 0

2023-02-15 11:20:58,522 WARNING got unexpected output threshold on conv Conv_20! value: 3.47228e-41

2023-02-15 11:20:58,522 WARNING got unexpected input threshold on conv Conv_22! value: 3.47228e-41

2023-02-15 11:20:58,522 WARNING got unexpected output threshold on conv Conv_22! value: 3.48979e-41

2023-02-15 11:20:58,522 WARNING got unexpected input threshold on conv Conv_24! value: 3.48979e-41

2023-02-15 11:20:58,522 WARNING got unexpected output threshold on conv Conv_24! value: 3.50255e-41

2023-02-15 11:20:58,522 WARNING got unexpected input threshold on conv Conv_26! value: 3.50255e-41

2023-02-15 11:20:58,523 WARNING got unexpected output threshold on conv Conv_26! value: 3.50142e-41

2023-02-15 11:20:58,523 WARNING got unexpected input threshold on conv Conv_28! value: 3.50142e-41

2023-02-15 11:20:58,523 WARNING got unexpected input threshold on conv Conv_33! value: 3.39689e-41

2023-02-15 11:20:58,523 WARNING got unexpected input threshold on conv UNIT_CONV_FOR_input.88_0.16616_TO_FUSE_SCALE! value: 0

2023-02-15 11:20:58,746 WARNING got unexpected output threshold on conv Conv_2! value: 6.07227e-40

2023-02-15 11:20:58,746 WARNING got unexpected input threshold on conv Conv_3! value: 6.07227e-40

2023-02-15 11:20:58,746 WARNING got unexpected output threshold on conv Conv_3! value: 3.1909e-41

2023-02-15 11:20:58,746 WARNING got unexpected input threshold on conv Conv_5! value: 3.1909e-41

2023-02-15 11:20:58,746 WARNING got unexpected output threshold on conv Conv_5! value: 3.45056e-41

2023-02-15 11:20:58,747 WARNING got unexpected input threshold on conv Conv_7! value: 3.45056e-41

2023-02-15 11:20:58,747 WARNING got unexpected output threshold on conv Conv_7! value: 3.50255e-41

2023-02-15 11:20:58,747 WARNING got unexpected input threshold on conv Conv_9! value: 3.50255e-41

2023-02-15 11:20:58,747 WARNING got unexpected output threshold on conv Conv_9! value: 3.39689e-41

2023-02-15 11:20:58,747 WARNING got unexpected input threshold on conv Conv_11! value: 3.39689e-41

2023-02-15 11:20:58,747 WARNING got unexpected output threshold on conv Conv_11! value: 3.49904e-41

2023-02-15 11:20:58,747 WARNING got unexpected input threshold on conv Conv_12! value: 3.49904e-41

2023-02-15 11:20:58,747 WARNING got unexpected output threshold on conv Conv_12! value: 3.48937e-41

2023-02-15 11:20:58,748 WARNING got unexpected input threshold on conv Conv_14! value: 3.48937e-41

2023-02-15 11:20:58,748 WARNING got unexpected output threshold on conv Conv_14! value: 3.14087e-41

2023-02-15 11:20:58,748 WARNING got unexpected input threshold on conv Conv_16! value: 3.14087e-41

2023-02-15 11:20:58,748 WARNING got unexpected output threshold on conv Conv_16! value: 0

2023-02-15 11:20:58,748 WARNING got unexpected input threshold on conv Conv_18! value: 0

2023-02-15 11:20:58,748 WARNING got unexpected output threshold on conv Conv_18! value: 0

2023-02-15 11:20:58,748 WARNING got unexpected input threshold on conv Conv_20! value: 0

2023-02-15 11:20:58,748 WARNING got unexpected output threshold on conv Conv_20! value: 3.47228e-41

2023-02-15 11:20:58,749 WARNING got unexpected input threshold on conv Conv_22! value: 3.47228e-41

2023-02-15 11:20:58,749 WARNING got unexpected output threshold on conv Conv_22! value: 3.48979e-41

2023-02-15 11:20:58,749 WARNING got unexpected input threshold on conv Conv_24! value: 3.48979e-41

2023-02-15 11:20:58,749 WARNING got unexpected output threshold on conv Conv_24! value: 3.50255e-41

2023-02-15 11:20:58,749 WARNING got unexpected input threshold on conv Conv_26! value: 3.50255e-41

2023-02-15 11:20:58,749 WARNING got unexpected output threshold on conv Conv_26! value: 3.50142e-41

2023-02-15 11:20:58,749 WARNING got unexpected input threshold on conv Conv_28! value: 3.50142e-41

2023-02-15 11:20:58,749 WARNING got unexpected input threshold on conv Conv_33! value: 3.39689e-41

2023-02-15 11:20:58,750 WARNING got unexpected input threshold on conv UNIT_CONV_FOR_input.88_0.11847_TO_FUSE_SCALE! value: 0

2023-02-15 11:20:58,966 WARNING got unexpected output threshold on conv Conv_2! value: 7.45457e-40

2023-02-15 11:20:58,966 WARNING got unexpected input threshold on conv Conv_3! value: 7.45457e-40

2023-02-15 11:20:58,966 WARNING got unexpected output threshold on conv Conv_3! value: 2.26436e-41

2023-02-15 11:20:58,966 WARNING got unexpected input threshold on conv Conv_5! value: 2.26436e-41

2023-02-15 11:20:58,966 WARNING got unexpected output threshold on conv Conv_5! value: 3.40179e-41

2023-02-15 11:20:58,966 WARNING got unexpected input threshold on conv Conv_7! value: 3.40179e-41

2023-02-15 11:20:58,967 WARNING got unexpected output threshold on conv Conv_7! value: 3.11929e-41

2023-02-15 11:20:58,967 WARNING got unexpected input threshold on conv Conv_9! value: 3.11929e-41

2023-02-15 11:20:58,967 WARNING got unexpected output threshold on conv Conv_9! value: 3.38834e-41

2023-02-15 11:20:58,967 WARNING got unexpected input threshold on conv Conv_11! value: 3.38834e-41

2023-02-15 11:20:58,967 WARNING got unexpected output threshold on conv Conv_11! value: 3.41524e-41

2023-02-15 11:20:58,967 WARNING got unexpected input threshold on conv Conv_12! value: 3.41524e-41

2023-02-15 11:20:58,967 WARNING got unexpected output threshold on conv Conv_12! value: 3.13947e-41

2023-02-15 11:20:58,967 WARNING got unexpected input threshold on conv Conv_14! value: 3.13947e-41

2023-02-15 11:20:58,968 WARNING got unexpected output threshold on conv Conv_14! value: 3.13064e-41

2023-02-15 11:20:58,968 WARNING got unexpected input threshold on conv Conv_16! value: 3.13064e-41

2023-02-15 11:20:58,968 WARNING got unexpected output threshold on conv Conv_16! value: 0

2023-02-15 11:20:58,968 WARNING got unexpected input threshold on conv Conv_18! value: 0

2023-02-15 11:20:58,968 WARNING got unexpected output threshold on conv Conv_18! value: 0

2023-02-15 11:20:58,968 WARNING got unexpected input threshold on conv Conv_20! value: 0

2023-02-15 11:20:58,968 WARNING got unexpected output threshold on conv Conv_20! value: 3.3917e-41

2023-02-15 11:20:58,968 WARNING got unexpected input threshold on conv Conv_22! value: 3.3917e-41

2023-02-15 11:20:58,969 WARNING got unexpected output threshold on conv Conv_22! value: 3.09911e-41

2023-02-15 11:20:58,969 WARNING got unexpected input threshold on conv Conv_24! value: 3.09911e-41

2023-02-15 11:20:58,969 WARNING got unexpected output threshold on conv Conv_24! value: 3.40516e-41

2023-02-15 11:20:58,969 WARNING got unexpected input threshold on conv Conv_26! value: 3.40516e-41

2023-02-15 11:20:58,969 WARNING got unexpected output threshold on conv Conv_26! value: 3.4287e-41

2023-02-15 11:20:58,969 WARNING got unexpected input threshold on conv Conv_28! value: 3.4287e-41

2023-02-15 11:20:58,969 WARNING got unexpected input threshold on conv Conv_33! value: 3.38834e-41

2023-02-15 11:20:58,969 WARNING got unexpected input threshold on conv UNIT_CONV_FOR_input.88_0.15841_TO_FUSE_SCALE! value: 0

2023-02-15 11:20:59,006 INFO Select max method.

2023-02-15 11:20:59,008 WARNING find illegal threshold in input.76, it will be set default.

2023-02-15 11:20:59,008 WARNING find illegal threshold in input.88, it will be set default.

2023-02-15 11:20:59,042 INFO [Wed Feb 15 11:20:59 2023] End to calibrate the model.

2023-02-15 11:20:59,043 INFO [Wed Feb 15 11:20:59 2023] Start to quantize the model.

2023-02-15 11:20:59,217 WARNING got unexpected output threshold on conv Conv_2! value: 7.66673e-40

2023-02-15 11:20:59,217 WARNING got unexpected input threshold on conv Conv_3! value: 7.66673e-40

2023-02-15 11:20:59,218 WARNING got unexpected output threshold on conv Conv_3! value: 3.1909e-41

2023-02-15 11:20:59,218 WARNING got unexpected input threshold on conv Conv_5! value: 3.1909e-41

2023-02-15 11:20:59,218 WARNING got unexpected output threshold on conv Conv_5! value: 3.45056e-41

2023-02-15 11:20:59,218 WARNING got unexpected input threshold on conv Conv_7! value: 3.45056e-41

2023-02-15 11:20:59,218 WARNING got unexpected output threshold on conv Conv_7! value: 3.50255e-41

2023-02-15 11:20:59,218 WARNING got unexpected input threshold on conv Conv_9! value: 3.50255e-41

2023-02-15 11:20:59,218 WARNING got unexpected output threshold on conv Conv_9! value: 3.39689e-41

2023-02-15 11:20:59,218 WARNING got unexpected input threshold on conv Conv_11! value: 3.39689e-41

2023-02-15 11:20:59,219 WARNING got unexpected output threshold on conv Conv_11! value: 3.49904e-41

2023-02-15 11:20:59,219 WARNING got unexpected input threshold on conv Conv_12! value: 3.49904e-41

2023-02-15 11:20:59,219 WARNING got unexpected output threshold on conv Conv_12! value: 3.48937e-41

2023-02-15 11:20:59,219 WARNING got unexpected input threshold on conv Conv_14! value: 3.48937e-41

2023-02-15 11:20:59,219 WARNING got unexpected output threshold on conv Conv_14! value: 3.14087e-41

2023-02-15 11:20:59,219 WARNING got unexpected input threshold on conv Conv_16! value: 3.14087e-41

2023-02-15 11:20:59,219 WARNING got unexpected output threshold on conv Conv_20! value: 3.47228e-41

2023-02-15 11:20:59,220 WARNING got unexpected input threshold on conv Conv_22! value: 3.47228e-41

2023-02-15 11:20:59,220 WARNING got unexpected output threshold on conv Conv_22! value: 3.48979e-41

2023-02-15 11:20:59,220 WARNING got unexpected input threshold on conv Conv_24! value: 3.48979e-41

2023-02-15 11:20:59,220 WARNING got unexpected output threshold on conv Conv_24! value: 3.50255e-41

2023-02-15 11:20:59,220 WARNING got unexpected input threshold on conv Conv_26! value: 3.50255e-41

2023-02-15 11:20:59,220 WARNING got unexpected output threshold on conv Conv_26! value: 3.50142e-41

2023-02-15 11:20:59,220 WARNING got unexpected input threshold on conv Conv_28! value: 3.50142e-41

2023-02-15 11:20:59,220 WARNING got unexpected input threshold on conv Conv_33! value: 3.39689e-41

2023-02-15 11:20:59,361 INFO input input is from resizer. Its layout is set to NHWC

2023-02-15 11:20:59,458 INFO [Wed Feb 15 11:20:59 2023] End to quantize the model.

2023-02-15 11:20:59,493 INFO Saving the quantized model: lprnet_20230209_1x3x32x96_sim_quantized_model.onnx.

2023-02-15 11:20:59,694 INFO [Wed Feb 15 11:20:59 2023] Start to compile the model with march bernoulli2.

2023-02-15 11:20:59,743 INFO Compile submodel: torch_jit_subgraph_0

2023-02-15 11:20:59,799 INFO hbdk-cc parameters:['--O0', '--core-num', '1', '--fast', '--input-layout', 'NHWC', '--output-layout', 'NCHW', '--input-source', 'resizer']

2023-02-15 11:21:00,203 INFO [Wed Feb 15 11:21:00 2023] End to compile the model with march bernoulli2.

Unsupported input source: 1

2023-02-15 11:21:00,642 INFO core[0] open!

2023-02-15 11:21:00,642 ERROR there is no enough memory for hbm infer, the model is too huge.

模型和量化数据在百度网盘

链接:https://pan.baidu.com/s/1LiwuGPtCGIU5ukxsKSZ2JQ

提取码:2wlq

供参考

算法工具链
评论2
0/1000
  • 颜值即正义
    Lv.2

    看了你的日志,对比了一下我的,在这儿发生了不一样,如下图:

    是不是电脑资源不足呀,请问你的电脑配置满足要求嘛?

    最好用服务器哈~

    2023-02-15
    0
    7
    • lvjj回复颜值即正义:

      是个小主机,各方面配置应该是远超过的(3080ti+32G),系统版本也是对应的(docker的话就更没有这个问题了)

      :(

      这可咋整啊

      这是我准备的量化数据有问题的意思吗

      2023-02-15
      0
    • 颜值即正义回复lvjj:

      我的量化数据就是用你提供的呀,我这边确实无法复现你的问题哈,我把我的所有工程文件打包一份发给你,你对比一下看看是哪儿问题哈。所有文件链接如下:https://pan.horizon.ai/index.php/s/ppm3dcz7cH8srkk

      2023-02-15
      0
    • lvjj回复颜值即正义:

      感谢,你给我的工程是可以在docker下跑通的,已经生成bin模型了。我具体对比一下两个工程的差异再来跟你反馈一下什么原因哈

      2023-02-15
      0
    • 颜值即正义回复lvjj:

      不客气哈,一起加油~

      2023-02-15
      0
    • lvjj回复颜值即正义:

      原因是之前尝试batchsize的时候文档中的batchsize设定没有被改过来,导致的问题,修正这个yaml的参数之后之前的OE版本也是可以使用的。

      然后再bin模型上板回灌图片测试的时候遇到了一个这样的问题

      我不太明白我的rois为什么没有符合规范,我的left top 和right bottom已经是对应的额奇数偶数了

      2023-02-15
      0
    • 颜值即正义回复lvjj:
      从报错日志看,你的rois确实不符合规范哈,odd表示奇数,even表示偶数
      2023-02-15
      0
    • lvjj回复颜值即正义:

      已解决,感谢

      2023-02-15
      0
  • 颜值即正义
    Lv.2
    2023-04-24
    0
    0