专栏算法工具链resnet50转模型后bin文件结果异常

resnet50转模型后bin文件结果异常

已解决
ljl202022-12-28
107
10

你好,将关键点模型转换成为地平线支持的bin文件后,结果与预期的结果产生了较大的偏差,转模型过程中只有警告,没有error,想看看这些警告是否会对最终结果产生影响,具体版本信息及log信息如下

[root@7fdafcee1636 mapper]# bash 03_build.sh

cd $(dirname $0)

config_file="./Rexnet_hand_landmark.yaml "

model_type="onnx"

# build model

hb_mapper makertbin --config ${config_file} \

--model-type ${model_type}

2022-12-28 15:16:36,237 INFO Start hb_mapper....

2022-12-28 15:16:36,237 INFO log will be stored in /home/work/ddk/samples/ai_toolchain/horizon_model_convert_sample/04_detection/10_handpose_detection/mapper/hb_mapper_makertbin.log

2022-12-28 15:16:36,237 INFO hbdk version 3.37.2

2022-12-28 15:16:36,238 INFO horizon_nn version 0.14.0

2022-12-28 15:16:36,238 INFO hb_mapper version 1.9.9

2022-12-28 15:16:36,238 INFO Start Model Convert....

2022-12-28 15:16:36,273 INFO Using abs path /home/work/ddk/samples/ai_toolchain/horizon_model_convert_sample/04_detection/10_handpose_detection/mapper/model/resnet_50_size-256_v2.onnx

2022-12-28 15:16:36,275 INFO validating model_parameters...

2022-12-28 15:16:36,541 WARNING User input 'log_level' deleted,Please do not use this parameter again

2022-12-28 15:16:36,541 INFO Using abs path /home/work/ddk/samples/ai_toolchain/horizon_model_convert_sample/04_detection/10_handpose_detection/mapper/model_output

2022-12-28 15:16:36,541 INFO validating model_parameters finished

2022-12-28 15:16:36,542 INFO validating input_parameters...

2022-12-28 15:16:36,542 INFO input num is set to 1 according to input_names

2022-12-28 15:16:36,542 INFO model name missing, using model name from model file: ['input']

2022-12-28 15:16:36,542 INFO model input shape missing, using shape from model file: [[1, 3, 256, 256]]

2022-12-28 15:16:36,543 INFO validating input_parameters finished

2022-12-28 15:16:36,543 INFO validating calibration_parameters...

2022-12-28 15:16:36,543 INFO Using abs path /home/work/ddk/samples/ai_toolchain/horizon_model_convert_sample/04_detection/10_handpose_detection/mapper/data

2022-12-28 15:16:36,543 INFO validating calibration_parameters finished

2022-12-28 15:16:36,543 INFO validating custom_op...

2022-12-28 15:16:36,544 INFO custom_op does not exist, skipped

2022-12-28 15:16:36,544 INFO validating custom_op finished

2022-12-28 15:16:36,544 INFO validating compiler_parameters...

2022-12-28 15:16:36,544 INFO validating compiler_parameters finished

2022-12-28 15:16:36,555 INFO *******************************************

2022-12-28 15:16:36,555 INFO First calibration picture name: Akimbo1_2525_rhand.jpg

2022-12-28 15:16:36,555 INFO First calibration picture md5:

27a2beb7b6a878b45c3edc788007423e /home/work/ddk/samples/ai_toolchain/horizon_model_convert_sample/04_detection/10_handpose_detection/mapper/data/Akimbo1_2525_rhand.jpg

2022-12-28 15:16:36,695 INFO *******************************************

2022-12-28 15:19:12,069 INFO [Wed Dec 28 15:19:12 2022] Start to Horizon NN Model Convert.

2022-12-28 15:19:12,070 INFO Parsing the input parameter:{'input': {'input_shape': [1, 3, 256, 256], 'input_batch': 1, 'expected_input_type': 'BGR_128', 'original_input_type': 'RGB', 'original_input_layout': 'NCHW', 'scales': array([0.00392157], dtype=float32)}}

2022-12-28 15:19:12,070 INFO Parsing the calibration parameter

2022-12-28 15:19:12,070 INFO Parsing the hbdk parameter:{'hbdk_pass_through_params': '--fast --O3', 'input-source': {'input': 'ddr', '_default_value': 'ddr'}}

2022-12-28 15:19:12,071 INFO HorizonNN version: 0.14.0

2022-12-28 15:19:12,071 INFO HBDK version: 3.37.2

2022-12-28 15:19:12,072 INFO [Wed Dec 28 15:19:12 2022] Start to parse the onnx model.

2022-12-28 15:19:12,230 INFO Input ONNX model infomation:

ONNX IR version: 7

Opset version: 11

Producer: pytorch1.10

Domain: none

Input name: input, [1, 3, 256, 256]

Output name: output, [1, 42]

2022-12-28 15:19:13,399 INFO [Wed Dec 28 15:19:13 2022] End to parse the onnx model.

2022-12-28 15:19:13,406 INFO Model input names: ['input']

2022-12-28 15:19:13,407 INFO Create a preprocessing operator for input_name input with means=None, std=[254.99998492], original_input_layout=NCHW, color convert from 'RGB' to 'BGR'.

2022-12-28 15:19:14,034 INFO Saving the original float model: resnet50_hand_landmark_original_float_model.onnx.

2022-12-28 15:19:14,035 INFO [Wed Dec 28 15:19:14 2022] Start to optimize the model.

Layer AveragePool_121

Kernel shape expect data shape range: [[1, 7],[1, 7]], but the data shape is [8, 8]

2022-12-28 15:19:16,643 INFO [Wed Dec 28 15:19:16 2022] End to optimize the model.

2022-12-28 15:19:16,821 INFO Saving the optimized model: resnet50_hand_landmark_optimized_float_model.onnx.

2022-12-28 15:19:16,821 INFO [Wed Dec 28 15:19:16 2022] Start to calibrate the model.

2022-12-28 15:19:16,822 INFO There are 83 samples in the calibration data set.

2022-12-28 15:19:17,718 INFO Run calibration model with default calibration method.

2022-12-28 15:20:47,481 WARNING got unexpected output threshold on conv Conv_97! value: 6.29018e-39

2022-12-28 15:20:47,482 WARNING got unexpected input threshold on conv Conv_99! value: 6.29018e-39

2022-12-28 15:20:47,483 WARNING got unexpected output threshold on conv Conv_99! value: 6.06222e-39

2022-12-28 15:20:47,484 WARNING got unexpected input threshold on conv Conv_101! value: 6.06222e-39

2022-12-28 15:20:58,249 WARNING got unexpected output threshold on conv Conv_97! value: 6.29018e-39

2022-12-28 15:20:58,250 WARNING got unexpected input threshold on conv Conv_99! value: 6.29018e-39

2022-12-28 15:20:58,250 WARNING got unexpected output threshold on conv Conv_99! value: 6.06222e-39

2022-12-28 15:20:58,250 WARNING got unexpected input threshold on conv Conv_101! value: 6.06222e-39

2022-12-28 15:21:08,798 WARNING got unexpected output threshold on conv Conv_97! value: -3.07165e-42

2022-12-28 15:21:08,799 WARNING got unexpected input threshold on conv Conv_99! value: -3.07165e-42

2022-12-28 15:21:08,799 WARNING got unexpected output threshold on conv Conv_99! value: 6.03594e-39

2022-12-28 15:21:08,799 WARNING got unexpected input threshold on conv Conv_101! value: 6.03594e-39

2022-12-28 15:21:11,107 INFO Select max-percentile:percentile=0.99995 method.

2022-12-28 15:21:11,241 INFO [Wed Dec 28 15:21:11 2022] End to calibrate the model.

2022-12-28 15:21:11,242 INFO [Wed Dec 28 15:21:11 2022] Start to quantize the model.

2022-12-28 15:21:19,184 WARNING got unexpected output threshold on conv Conv_97! value: 6.29018e-39

2022-12-28 15:21:19,185 WARNING got unexpected input threshold on conv Conv_99! value: 6.29018e-39

2022-12-28 15:21:19,186 WARNING got unexpected output threshold on conv Conv_99! value: 6.06222e-39

2022-12-28 15:21:19,187 WARNING got unexpected input threshold on conv Conv_101! value: 6.06222e-39

2022-12-28 15:21:23,147 INFO [Wed Dec 28 15:21:23 2022] End to quantize the model.

2022-12-28 15:21:23,901 INFO Saving the quantized model: resnet50_hand_landmark_quantized_model.onnx.

2022-12-28 15:21:25,880 INFO [Wed Dec 28 15:21:25 2022] Start to compile the model with march bernoulli2.

2022-12-28 15:21:27,218 INFO Compile submodel: torch-jit-export_subgraph_0

2022-12-28 15:21:28,559 INFO hbdk-cc parameters:['--fast', '--O3', '--input-layout', 'NHWC', '--output-layout', 'NHWC', '--input-source', 'ddr']

2022-12-28 15:21:29,066 INFO INFO: "-j" or "--jobs" is not specified, launch 16 threads for optimization

[==================================================] 100%

2022-12-28 15:21:43,362 INFO consumed time 14.3681

2022-12-28 15:21:44,143 INFO FPS=44.88, latency = 22279.7 us (see torch-jit-export_subgraph_0.html)

2022-12-28 15:21:44,909 INFO [Wed Dec 28 15:21:44 2022] End to compile the model with march bernoulli2.

2022-12-28 15:21:44,912 INFO The converted model node information:

========================================================================================================================================

Node ON Subgraph Type Cosine Similarity Threshold

----------------------------------------------------------------------------------------------------------------------------------------

HZ_PREPROCESS_FOR_input BPU id(0) HzSQuantizedPreprocess 0.999978 127.000000

Conv_0 BPU id(0) HzSQuantizedConv 0.999941 0.999670

MaxPool_2 BPU id(0) HzQuantizedMaxPool 0.999943 1.828348

Conv_3 BPU id(0) HzSQuantizedConv 0.999923 1.828348

Conv_5 BPU id(0) HzSQuantizedConv 0.999902 2.284879

Conv_7 BPU id(0) HzSQuantizedConv 0.999611 2.042290

Conv_8 BPU id(0) HzSQuantizedConv 0.998421 1.828348

Conv_11 BPU id(0) HzSQuantizedConv 0.997513 2.502869

Conv_13 BPU id(0) HzSQuantizedConv 0.998320 2.334687

Conv_15 BPU id(0) HzSQuantizedConv 0.996838 3.085759

Conv_18 BPU id(0) HzSQuantizedConv 0.995826 2.587685

Conv_20 BPU id(0) HzSQuantizedConv 0.981964 1.646775

Conv_22 BPU id(0) HzSQuantizedConv 0.994438 2.032530

Conv_25 BPU id(0) HzSQuantizedConv 0.994178 2.649221

Conv_27 BPU id(0) HzSQuantizedConv 0.989486 1.860260

Conv_29 BPU id(0) HzSQuantizedConv 0.986690 1.366122

Conv_30 BPU id(0) HzSQuantizedConv 0.992656 2.649221

Conv_33 BPU id(0) HzSQuantizedConv 0.999457 1.992146

Conv_35 BPU id(0) HzSQuantizedConv 0.996708 1.320983

Conv_37 BPU id(0) HzSQuantizedConv 0.992317 1.661718

Conv_40 BPU id(0) HzSQuantizedConv 0.991305 2.868571

Conv_42 BPU id(0) HzSQuantizedConv 0.993002 1.428989

Conv_44 BPU id(0) HzSQuantizedConv 0.989826 1.318379

Conv_47 BPU id(0) HzSQuantizedConv 0.988937 2.869920

Conv_49 BPU id(0) HzSQuantizedConv 0.987961 1.596592

Conv_51 BPU id(0) HzSQuantizedConv 0.987356 1.583556

Conv_54 BPU id(0) HzSQuantizedConv 0.983896 2.978922

Conv_56 BPU id(0) HzSQuantizedConv 0.993261 1.777179

Conv_58 BPU id(0) HzSQuantizedConv 0.990025 1.811175

Conv_59 BPU id(0) HzSQuantizedConv 0.993075 2.978922

Conv_62 BPU id(0) HzSQuantizedConv 0.996227 1.203375

Conv_64 BPU id(0) HzSQuantizedConv 0.994167 1.703897

Conv_66 BPU id(0) HzSQuantizedConv 0.992066 1.504017

Conv_69 BPU id(0) HzSQuantizedConv 0.993053 1.717441

Conv_71 BPU id(0) HzSQuantizedConv 0.992160 1.865894

Conv_73 BPU id(0) HzSQuantizedConv 0.988569 2.068972

Conv_76 BPU id(0) HzSQuantizedConv 0.990951 2.443835

Conv_78 BPU id(0) HzSQuantizedConv 0.988164 1.689705

Conv_80 BPU id(0) HzSQuantizedConv 0.984598 1.565975

Conv_83 BPU id(0) HzSQuantizedConv 0.984465 2.569460

Conv_85 BPU id(0) HzSQuantizedConv 0.984875 1.498896

Conv_87 BPU id(0) HzSQuantizedConv 0.980273 1.301170

Conv_90 BPU id(0) HzSQuantizedConv 0.978535 2.667545

Conv_92 BPU id(0) HzSQuantizedConv 0.981205 1.959337

Conv_94 BPU id(0) HzSQuantizedConv 0.973635 1.696927

Conv_97 BPU id(0) HzSQuantizedConv 1.000000 3.586998

Conv_99 BPU id(0) HzSQuantizedConv 1.000000 0.000000

Conv_101 BPU id(0) HzSQuantizedConv 0.999398 0.000000

Conv_102 BPU id(0) HzSQuantizedConv 0.962718 3.586998

Conv_105 BPU id(0) HzSQuantizedConv 0.977644 1.024274

Conv_107 BPU id(0) HzSQuantizedConv 0.982468 2.375292

Conv_109 BPU id(0) HzSQuantizedConv 0.978757 4.316766

Conv_112 BPU id(0) HzSQuantizedConv 0.995510 0.623375

Conv_114 BPU id(0) HzSQuantizedConv 0.999369 0.872599

Conv_116 BPU id(0) HzSQuantizedConv 0.986875 2.427384

AveragePool_121_SPLIT_WITH_DEPTHWISE_CONV_0 BPU id(0) HzSQuantizedConv 0.989126 0.542223

AveragePool_121 BPU id(0) HzSQuantizedConv 0.992114 0.118721

Gemm_123 BPU id(0) HzSQuantizedConv 0.999859 0.054926

Gemm_123_NHWC2NCHW_LayoutConvert_Output0_reshape CPU -- Reshape

2022-12-28 15:21:44,912 INFO The quantify model output:

===========================================================================

Node Cosine Similarity L1 Distance L2 Distance Chebyshev Distance

---------------------------------------------------------------------------

Gemm_123 0.999859 0.006301 0.001390 0.032242

2022-12-28 15:21:44,913 INFO [Wed Dec 28 15:21:44 2022] End to Horizon NN Model Convert.

2022-12-28 15:21:45,088 INFO start convert to *.bin file....

2022-12-28 15:21:45,263 INFO ONNX model output num : 1

2022-12-28 15:21:45,264 INFO ############# model deps info #############

2022-12-28 15:21:45,265 INFO hb_mapper version : 1.9.9

2022-12-28 15:21:45,265 INFO hbdk version : 3.37.2

2022-12-28 15:21:45,265 INFO hbdk runtime version: 3.14.14

2022-12-28 15:21:45,266 INFO horizon_nn version : 0.14.0

2022-12-28 15:21:45,266 INFO ############# model_parameters info #############

2022-12-28 15:21:45,266 INFO onnx_model : /home/work/ddk/samples/ai_toolchain/horizon_model_convert_sample/04_detection/10_handpose_detection/mapper/model/resnet_50_size-256_v2.onnx

2022-12-28 15:21:45,266 INFO BPU march : bernoulli2

2022-12-28 15:21:45,267 INFO layer_out_dump : False

2022-12-28 15:21:45,267 INFO log_level : DEBUG

2022-12-28 15:21:45,267 INFO working dir : /home/work/ddk/samples/ai_toolchain/horizon_model_convert_sample/04_detection/10_handpose_detection/mapper/model_output

2022-12-28 15:21:45,267 INFO output_model_file_prefix: resnet50_hand_landmark

2022-12-28 15:21:45,268 INFO ############# input_parameters info #############

2022-12-28 15:21:45,268 INFO ------------------------------------------

2022-12-28 15:21:45,268 INFO ---------input info : input ---------

2022-12-28 15:21:45,269 INFO input_name : input

2022-12-28 15:21:45,269 INFO input_type_rt : bgr

2022-12-28 15:21:45,269 INFO input_space&range : regular

2022-12-28 15:21:45,269 INFO input_layout_rt : NHWC

2022-12-28 15:21:45,270 INFO input_type_train : rgb

2022-12-28 15:21:45,270 INFO input_layout_train : NCHW

2022-12-28 15:21:45,270 INFO norm_type : data_scale

2022-12-28 15:21:45,270 INFO input_shape : 1x3x256x256

2022-12-28 15:21:45,270 INFO input_batch : 1

2022-12-28 15:21:45,270 INFO scale_value : 0.003921568627451,

2022-12-28 15:21:45,271 INFO cal_data_dir : /home/work/ddk/samples/ai_toolchain/horizon_model_convert_sample/04_detection/10_handpose_detection/mapper/data

2022-12-28 15:21:45,271 INFO ---------input info : input end -------

2022-12-28 15:21:45,271 INFO ------------------------------------------

2022-12-28 15:21:45,271 INFO ############# calibration_parameters info #############

2022-12-28 15:21:45,271 INFO preprocess_on : True

2022-12-28 15:21:45,271 INFO calibration_type: : default

2022-12-28 15:21:45,272 INFO cal_data_type : float32

2022-12-28 15:21:45,272 INFO ############# compiler_parameters info #############

2022-12-28 15:21:45,272 INFO hbdk_pass_through_params: --fast --O3

2022-12-28 15:21:45,272 INFO input-source : {'input': 'ddr', '_default_value': 'ddr'}

2022-12-28 15:21:45,334 INFO Convert to runtime bin file sucessfully!

2022-12-28 15:21:45,335 INFO End Model Convert

算法工具链
评论1
0/1000
  • ljl20
    Lv.1

    1、

    2022-12-28 15:19:14,035 INFO [Wed Dec 28 15:19:14 2022] Start to optimize the model.

    Layer AveragePool_121

    Kernel shape expect data shape range: [[1, 7],[1, 7]], but the data shape is [8, 8]

    2、

    2022-12-28 15:20:47,481 WARNING got unexpected output threshold on conv Conv_97! value: 6.29018e-39

    2022-12-28 15:20:47,482 WARNING got unexpected input threshold on conv Conv_99! value: 6.29018e-39

    2022-12-28 15:20:47,483 WARNING got unexpected output threshold on conv Conv_99! value: 6.06222e-39

    2022-12-28 15:20:47,484 WARNING got unexpected input threshold on conv Conv_101! value: 6.06222e-39

    2022-12-28 15:20:58,249 WARNING got unexpected output threshold on conv Conv_97! value: 6.29018e-39

    2022-12-28 15:20:58,250 WARNING got unexpected input threshold on conv Conv_99! value: 6.29018e-39

    2022-12-28 15:20:58,250 WARNING got unexpected output threshold on conv Conv_99! value: 6.06222e-39

    2022-12-28 15:20:58,250 WARNING got unexpected input threshold on conv Conv_101! value: 6.06222e-39

    2022-12-28 15:21:08,798 WARNING got unexpected output threshold on conv Conv_97! value: -3.07165e-42

    2022-12-28 15:21:08,799 WARNING got unexpected input threshold on conv Conv_99! value: -3.07165e-42

    2022-12-28 15:21:08,799 WARNING got unexpected output threshold on conv Conv_99! value: 6.03594e-39

    2022-12-28 15:21:08,799 WARNING got unexpected input threshold on conv Conv_101! value: 6.03594e-39

    2022-12-28 15:21:11,107 INFO Select max-percentile:percentile=0.99995 method.

    2022-12-28 15:21:11,241 INFO [Wed Dec 28 15:21:11 2022] End to calibrate the model.

    2022-12-28 15:21:11,242 INFO [Wed Dec 28 15:21:11 2022] Start to quantize the model.

    2022-12-28 15:21:19,184 WARNING got unexpected output threshold on conv Conv_97! value: 6.29018e-39

    2022-12-28 15:21:19,185 WARNING got unexpected input threshold on conv Conv_99! value: 6.29018e-39

    2022-12-28 15:21:19,186 WARNING got unexpected output threshold on conv Conv_99! value: 6.06222e-39

    2022-12-28 15:21:19,187 WARNING got unexpected input threshold on conv Conv_101! value: 6.06222e-39

    请问这两个警告是什么意思,会对最终结果产生不良影响吗

    2022-12-28
    0
    9
    • 颜值即正义回复ljl20:
      关于警告1,是kernel shape的大小超出了限制,如果这层AveragePool的kernel shape为8x8的目的是实现类似于全局平均池化的效果,建议您尝试修改为GlobalAveragePool试试看。

      关于警告2,是卷积的量化阈值太小的警告,正常不需要关注。

      精度出现一些问题,建议您参考下方链接进行尝试优化:https://developer.horizon.ai/forumDetail/71036815603174578

      2022-12-29
      1
    • ljl20回复颜值即正义:

      现在发现一个问题,做的同样的预处理,预处理只是把图像做了resize操作,quanti_onnx结果正常,bin文件获取到的结果异常。

      源onnx预处理:

      源onnx推理结果:

      quanti_onnx预处理:

      quanti_onnx推理结果:

      bin文件预处理:

      bin文件推理结果:

      其中yaml文件配置为:

      # Copyright (c) 2020 Horizon Robotics.All Rights Reserved.

      #

      # The material in this file is confidential and contains trade secrets

      # of Horizon Robotics Inc. This is proprietary information owned by

      # Horizon Robotics Inc. No part of this work may be disclosed,

      # reproduced, copied, transmitted, or used in any way for any purpose,

      # without the express written permission of Horizon Robotics Inc.

      # 模型转化相关的参数

      # ------------------------------------

      # model conversion related parameters

      model_parameters:

      # Onnx浮点网络数据模型文件

      # -----------------------------------------------------------

      # the model file of floating-point ONNX neural network data

      #onnx_model: '../../../01_common/model_zoo/mapper/detection/yolov5_onnx_optimized/YOLOv5s.onnx'

      onnx_model: './model/ReXNetV1_size-256_v2.onnx'

      # 适用BPU架构

      # --------------------------------

      # the applicable BPU architecture

      march: "bernoulli2"

      # 指定模型转换过程中是否输出各层的中间结果,如果为True,则输出所有层的中间输出结果,

      # --------------------------------------------------------------------------------------

      # specifies whether or not to dump the intermediate results of all layers in conversion

      # if set to True, then the intermediate results of all layers shall be dumped

      layer_out_dump: False

      # 用于设置上板模型输出的layout, 支持NHWC和NCHW, 输入NULL则使用模型默认格式

      # # ---------------------------------------------------------------------

      # # is used for specifying the layout of model output on dev board

      # # both NHWC and NCHW layouts are supported,

      # # if input is NULL then the default layout of the model will be used

      # output_layout: NHWC

      # 模型转换输出的结果的存放目录

      # -----------------------------------------------------------

      # the directory in which model conversion results are stored

      working_dir: 'model_output'

      # 模型转换输出的用于上板执行的模型文件的名称前缀

      # -----------------------------------------------------------------------------------------

      # model conversion generated name prefix of those model files used for dev board execution

      output_model_file_prefix: 'ReXNetV1_hand_landmark'

      # 模型输入相关参数, 若输入多个节点, 则应使用';'进行分隔, 使用默认缺省设置则写NULL

      # --------------------------------------------------------------------------

      # model input related parameters,

      # please use ";" to seperate when inputting multiple nodes,

      # please use NULL for default setting

      input_parameters:

      # (选填) 模型输入的节点名称, 此名称应与模型文件中的名称一致, 否则会报错, 不填则会使用模型文件中的节点名称

      # --------------------------------------------------------------------------------------------------------

      # (Optional) node name of model input,

      # it shall be the same as the name of model file, otherwise an error will be reported,

      # the node name of model file will be used when left blank

      # input_name: "input"

      # 网络实际执行时,输入给网络的数据格式,包括 nv12/rgb/bgr/yuv444/gray/featuremap,

      # ------------------------------------------------------------------------------------------

      # the data formats to be passed into neural network when actually performing neural network

      # available options: nv12/rgb/bgr/yuv444/gray/featuremap,

      input_type_rt: 'bgr'

      # 网络实际执行时输入的数据排布, 可选值为 NHWC/NCHW

      # 若input_type_rt配置为nv12,则此处参数不需要配置

      # ------------------------------------------------------------------

      # the data layout formats to be passed into neural network when actually performing neural network, available options: NHWC/NCHW

      # If input_type_rt is configured as nv12, then this parameter does not need to be configured

      input_layout_rt: 'NHWC'

      # 网络训练时输入的数据格式,可选的值为rgb/bgr/gray/featuremap/yuv444

      # --------------------------------------------------------------------

      # the data formats in network training

      # available options: rgb/bgr/gray/featuremap/yuv444

      input_type_train: 'bgr'

      # 网络训练时输入的数据排布, 可选值为 NHWC/NCHW

      # ------------------------------------------------------------------

      # the data layout in network training, available options: NHWC/NCHW

      input_layout_train: 'NCHW'

      # (选填) 模型网络的输入大小, 以'x'分隔, 不填则会使用模型文件中的网络输入大小,否则会覆盖模型文件中输入大小

      # -------------------------------------------------------------------------------------------

      # (Optional)the input size of model network, seperated by 'x'

      # note that the network input size of model file will be used if left blank

      # otherwise it will overwrite the input size of model file

      # input_shape: ''

      # 网络实际执行时,输入给网络的batch_size, 默认值为1

      # ---------------------------------------------------------------------

      # the data batch_size to be passed into neural network when actually performing neural network, default value: 1

      input_batch: 1

      # 网络输入的预处理方法,主要有以下几种:

      # no_preprocess 不做任何操作

      # data_mean 减去通道均值mean_value

      # data_scale 对图像像素乘以data_scale系数

      # data_mean_and_scale 减去通道均值后再乘以scale系数

      # -------------------------------------------------------------------------------------------

      # preprocessing methods of network input, available options:

      # 'no_preprocess' indicates that no preprocess will be made

      # 'data_mean' indicates that to minus the channel mean, i.e. mean_value

      # 'data_scale' indicates that image pixels to multiply data_scale ratio

      # 'data_mean_and_scale' indicates that to multiply scale ratio after channel mean is minused

      # norm_type: 'data_mean_and_scale'

      norm_type: 'data_mean_and_scale'

      # 图像减去的均值, 如果是通道均值,value之间必须用空格分隔

      # --------------------------------------------------------------------------

      # the mean value minused by image

      # note that values must be seperated by space if channel mean value is used

      mean_value: 128

      # 图像预处理缩放比例,如果是通道缩放比例,value之间必须用空格分隔

      # ---------------------------------------------------------------------------

      # scale value of image preprocess

      # note that values must be seperated by space if channel scale value is used

      # scale_value: 0.00784314

      scale_value: 0.00390625

      # 模型量化相关参数

      # -----------------------------

      # model calibration parameters

      calibration_parameters:

      # 模型量化的参考图像的存放目录,图片格式支持Jpeg、Bmp等格式,输入的图片

      # 应该是使用的典型场景,一般是从测试集中选择20~100张图片,另外输入

      # 的图片要覆盖典型场景,不要是偏僻场景,如过曝光、饱和、模糊、纯黑、纯白等图片

      # 若有多个输入节点, 则应使用';'进行分隔

      # -------------------------------------------------------------------------------------------------

      # the directory where reference images of model quantization are stored

      # image formats include JPEG, BMP etc.

      # should be classic application scenarios, usually 20~100 images are picked out from test datasets

      # in addition, note that input images should cover typical scenarios

      # and try to avoid those overexposed, oversaturated, vague,

      # pure blank or pure white images

      # use ';' to seperate when there are multiple input nodes

      cal_data_dir: './data'

      # 校准数据二进制文件的数据存储类型,可选值为:float32, uint8

      # calibration data binary file save type, available options: float32, uint8

      cal_data_type: 'float32'

      # 如果输入的图片文件尺寸和模型训练的尺寸不一致时,并且preprocess_on为true,

      # 则将采用默认预处理方法(skimage resize),

      # 将输入图片缩放或者裁减到指定尺寸,否则,需要用户提前把图片处理为训练时的尺寸

      # ---------------------------------------------------------------------------------

      # In case the size of input image file is different from that of in model training

      # and that preprocess_on is set to True,

      # shall the default preprocess method(skimage resize) be used

      # i.e., to resize or crop input image into specified size

      # otherwise user must keep image size as that of in training in advance

      preprocess_on: True

      # 模型量化的算法类型,支持kl、max、default、load,通常采用default即可满足要求, 若为QAT导出的模型, 则应选择load

      # ----------------------------------------------------------------------------------

      # types of model quantization algorithms, usually default will meet the need

      # available options:kl, max, default and load

      # if converted model is quanti model exported from QAT , then choose `load`

      # calibration_type: 'default'

      calibration_type: 'default'

      # 编译器相关参数

      # ----------------------------

      # compiler related parameters

      compiler_parameters:

      # 编译策略,支持bandwidth和latency两种优化模式;

      # bandwidth以优化ddr的访问带宽为目标;

      # latency以优化推理时间为目标

      # -------------------------------------------------------------------------------------------

      # compilation strategy, there are 2 available optimization modes: 'bandwidth' and 'lantency'

      # the 'bandwidth' mode aims to optimize ddr access bandwidth

      # while the 'lantency' mode aims to optimize inference duration

      compile_mode: 'latency'

      # 设置debug为True将打开编译器的debug模式,能够输出性能仿真的相关信息,如帧率、DDR带宽占用等

      # -----------------------------------------------------------------------------------

      # the compiler's debug mode will be enabled by setting to True

      # this will dump performance simulation related information

      # such as: frame rate, DDR bandwidth usage etc.

      debug: False

      # 编译模型指定核数,不指定默认编译单核模型, 若编译双核模型,将下边注释打开即可

      # -------------------------------------------------------------------------------------

      # specifies number of cores to be used in model compilation

      # as default, single core is used as this value left blank

      # please delete the "# " below to enable dual-core mode when compiling dual-core model

      # core_num: 2

      # 优化等级可选范围为O0~O3

      # O0不做任何优化, 编译速度最快,优化程度最低,

      # O1-O3随着优化等级提高,预期编译后的模型的执行速度会更快,但是所需编译时间也会变长。

      # 推荐用O2做最快验证

      # ----------------------------------------------------------------------------------------------------------

      # optimization level ranges between O0~O3

      # O0 indicates that no optimization will be made

      # the faster the compilation, the lower optimization level will be

      # O1-O3: as optimization levels increase gradually, model execution, after compilation, shall become faster

      # while compilation will be prolonged

      # it is recommended to use O2 for fastest verification

      optimize_level: 'O3'

      2022-12-29
      2
    • ljl20回复ljl20:

      这个感觉不是掉精度的问题了,感觉bin文件除了第一个值正常,感觉其他的输出值都不太正常

      2022-12-29
      0
    • ljl20回复ljl20:

      这个是表示bin文件与quanti_onnx文件转换过程中没出现结果异常是吗

      2022-12-29
      0
    • 颜值即正义回复ljl20:
      您好,在开发机环境使用 hb_model_verifier 工具进行一致性验证,从截图看,说明bin和quantized.onnx输出一致性是通过的,这样的话,需要您仔细检查一下前后处理代码哈
      2022-12-29
      0
    • ljl20回复颜值即正义:

      我已经把图像输入成全0了,还是不太对,这个输出的值没做任何后处理,就是直接从模型源输出的值,前后处理我可以确定没有问题,就是很奇怪,还有什么定位方法吗

      2022-12-30
      0
    • 颜值即正义回复ljl20:

      hb_model_verifier就是用来验证quantized.onnx和bin的一致性的哈。

      新版工具链已发布,欢迎尝试使用哈:

      OE发布包:

      wget -c ftp://vrftp.horizon.ai/Open_Explorer_gcc_9.3.0/2.4.2/horizon_xj3_open_explorer_v2.4.2_20221227.tar.gz

      文档:

      wget -c ftp://vrftp.horizon.ai/Open_Explorer_gcc_9.3.0/2.4.2/horizon_xj3_open_explorer_v2.4.2_doc.zip

      Docker:

      wget -c ftp://vrftp.horizon.ai/Open_Explorer_gcc_9.3.0/2.4.2/docker_openexplorer_centos_7_xj3_v2.4.2.tar.gz

      md5sum:

      wget -c ftp://vrftp.horizon.ai/Open_Explorer_gcc_9.3.0/2.4.2/md5sum.txt

      release_note:

      wget -c ftp://vrftp.horizon.ai/Open_Explorer_gcc_9.3.0/2.4.2/release_note.txt

      2022-12-30
      0
    • ljl20回复颜值即正义:
      你好,请问一下,矩阵乘法支持BPU支持吗,我这里的

      这个Mul都是在CPU上运行,怎么能让其在BPU上运行

      2023-01-03
      0
    • 颜值即正义回复ljl20:

      您好,Mul是支持运行在BPU上的,但需要满足一些限制,您可以在产品手册中对照算子支持列表进行使用。

      此外,建议您下次提问时新开帖子哈,把您的情况描述完整(比如不同的工具链版本在很多功能上是不同的)

      2023-01-03
      0