【X3】|工具链使用

官方示例:Yolov5s部署

1 验证模型

利用hb_mapper checker后面跟一堆参数来对模型进行配置

2 准备校准数据

因为BPU是INT8计算,所以注定会有精度损失。而且这些误差也是可以传递的,所以到后面精度是越来越低的。如果网络深度过高,也会导致整体精度的下降。
python3 …/…/…/data_preprocess.py
–src_dir …/…/…/01_common/calibration_data/coco
–dst_dir ./calibration_data_rgb_f32
–pic_ext .rgb
–read_mode opencv

3

hb_mapper makertbin --config ./yolov5s_config.yaml --model-type onnx


# 模型转化相关的参数
# ------------------------------------
# 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'

  # 适用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

  # 模型转换输出的结果的存放目录
  # -----------------------------------------------------------
  # 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: 'yolov5s_672x672_nv12'

# 模型输入相关参数, 若输入多个节点, 则应使用';'进行分隔, 使用默认缺省设置则写None
# --------------------------------------------------------------------------
# model input related parameters,
# please use ";" to seperate when inputting multiple nodes,
# please use None 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: ""

  # 网络实际执行时,输入给网络的数据格式,包括 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: 'nv12'

  # 网络实际执行时输入的数据排布, 可选值为 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: ''

  # 网络训练时输入的数据格式,可选的值为rgb/bgr/gray/featuremap/yuv444
  # --------------------------------------------------------------------
  # the data formats in network training
  # available options: rgb/bgr/gray/featuremap/yuv444
  input_type_train: 'rgb'

  # 网络训练时输入的数据排布, 可选值为 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_scale'

  # 图像减去的均值, 如果是通道均值,value之间必须用空格分隔
  # --------------------------------------------------------------------------
  # the mean value minused by image
  # note that values must be seperated by space if channel mean value is used
  mean_value: ''

  # 图像预处理缩放比例,如果是通道缩放比例,value之间必须用空格分隔
  # ---------------------------------------------------------------------------
  # scale value of image preprocess
  # note that values must be seperated by space if channel scale value is used
  scale_value: 0.003921568627451

# 模型量化相关参数
# -----------------------------
# 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: './calibration_data_rgb_f32'

  # 校准数据二进制文件的数据存储类型,可选值为: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: False

  # 模型量化的算法类型,支持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'

# 编译器相关参数
# ----------------------------
# 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
[root@27422ea0f8ea mapper]# hb_mapper makertbin --config ./yolov5s_config.yaml   --model-type  onnx
2022-10-04 17:45:17,252 INFO Start hb_mapper....
2022-10-04 17:45:17,252 INFO log will be stored in /open_explorer/ddk/samples/ai_toolchain/horizon_model_convert_sample/04_detection/03_yolov5s/mapper/hb_mapper_makertbin.log
2022-10-04 17:45:17,252 INFO hbdk version 3.37.2
2022-10-04 17:45:17,252 INFO horizon_nn version 0.14.0
2022-10-04 17:45:17,252 INFO hb_mapper version 1.9.9
2022-10-04 17:45:17,252 INFO Start Model Convert....
2022-10-04 17:45:17,263 INFO Using abs path /open_explorer/ddk/samples/ai_toolchain/horizon_model_convert_sample/01_common/model_zoo/mapper/detection/yolov5_onnx_optimized/YOLOv5s.onnx
2022-10-04 17:45:17,264 INFO validating model_parameters...
2022-10-04 17:45:17,283 WARNING User input 'log_level' deleted,Please do not use this parameter again
2022-10-04 17:45:17,283 INFO Using abs path /open_explorer/ddk/samples/ai_toolchain/horizon_model_convert_sample/04_detection/03_yolov5s/mapper/model_output
2022-10-04 17:45:17,283 INFO validating model_parameters finished
2022-10-04 17:45:17,284 INFO validating input_parameters...
2022-10-04 17:45:17,284 INFO input num is set to 1 according to input_names
2022-10-04 17:45:17,284 INFO model name missing, using model name from model file: ['data']
2022-10-04 17:45:17,284 INFO model input shape missing, using shape from model file: [[1, 3, 672, 672]]
2022-10-04 17:45:17,284 INFO validating input_parameters finished
2022-10-04 17:45:17,284 INFO validating calibration_parameters...
2022-10-04 17:45:17,284 INFO Using abs path /open_explorer/ddk/samples/ai_toolchain/horizon_model_convert_sample/04_detection/03_yolov5s/mapper/calibration_data_rgb_f32
2022-10-04 17:45:17,284 INFO validating calibration_parameters finished
2022-10-04 17:45:17,284 INFO validating custom_op...
2022-10-04 17:45:17,284 INFO custom_op does not exist, skipped
2022-10-04 17:45:17,284 INFO validating custom_op finished
2022-10-04 17:45:17,285 INFO validating compiler_parameters...
2022-10-04 17:45:17,285 INFO validating compiler_parameters finished
2022-10-04 17:45:17,288 INFO The calibration dir name suffix is the same as the value float32 of the cal_data_type parameter and will be read with the value of cal_data_type
2022-10-04 17:45:17,288 INFO *******************************************
2022-10-04 17:45:17,288 INFO First calibration picture name: COCO_val2014_000000181007.rgb
2022-10-04 17:45:17,288 INFO First calibration picture md5:
136bb23027c812cc2978395421fe6be7  /open_explorer/ddk/samples/ai_toolchain/horizon_model_convert_sample/04_detection/03_yolov5s/mapper/calibration_data_rgb_f32/COCO_val2014_000000181007.rgb
2022-10-04 17:45:17,302 INFO *******************************************
2022-10-04 17:45:20,374 INFO [Tue Oct  4 17:45:20 2022] Start to Horizon NN Model Convert.
2022-10-04 17:45:20,374 INFO Parsing the input parameter:{'data': {'input_shape': [1, 3, 672, 672], 'expected_input_type': 'YUV444_128', 'original_input_type': 'RGB', 'original_input_layout': 'NCHW', 'scales': array([0.00392157], dtype=float32)}}
2022-10-04 17:45:20,375 INFO Parsing the calibration parameter
2022-10-04 17:45:20,375 INFO Parsing the hbdk parameter:{'hbdk_pass_through_params': '--fast --O3', 'input-source': {'data': 'pyramid', '_default_value': 'ddr'}}
2022-10-04 17:45:20,375 INFO HorizonNN version: 0.14.0
2022-10-04 17:45:20,375 INFO HBDK version: 3.37.2
2022-10-04 17:45:20,375 INFO [Tue Oct  4 17:45:20 2022] Start to parse the onnx model.
2022-10-04 17:45:20,383 INFO Input ONNX model infomation:
ONNX IR version:          6
Opset version:            10
Producer:                 pytorch1.6
Domain:                   none
Input name:               data, [1, 3, 672, 672]
Output name:              output, [1, 84, 84, 255]
Output name:              641, [1, 42, 42, 255]
Output name:              643, [1, 21, 21, 255]
2022-10-04 17:45:20,448 INFO [Tue Oct  4 17:45:20 2022] End to parse the onnx model.
2022-10-04 17:45:20,448 INFO Model input names: ['data']
2022-10-04 17:45:20,449 INFO Create a preprocessing operator for input_name data with means=None, std=[254.99998492], original_input_layout=NCHW, color convert from 'RGB' to 'YUV_BT601_FULL_RANGE'.
2022-10-04 17:45:20,506 INFO Saving the original float model: yolov5s_672x672_nv12_original_float_model.onnx.
2022-10-04 17:45:20,507 INFO [Tue Oct  4 17:45:20 2022] Start to optimize the model.
2022-10-04 17:45:21,519 INFO [Tue Oct  4 17:45:21 2022] End to optimize the model.
2022-10-04 17:45:21,537 INFO Saving the optimized model: yolov5s_672x672_nv12_optimized_float_model.onnx.
2022-10-04 17:45:21,537 INFO [Tue Oct  4 17:45:21 2022] Start to calibrate the model.
2022-10-04 17:45:21,537 INFO There are 50 samples in the calibration data set.
2022-10-04 17:45:21,952 INFO Run calibration model with default calibration method.
2022-10-04 17:46:17,313 INFO Select max-percentile:percentile=0.99995 method.
2022-10-04 17:46:17,348 INFO [Tue Oct  4 17:46:17 2022] End to calibrate the model.
2022-10-04 17:46:17,348 INFO [Tue Oct  4 17:46:17 2022] Start to quantize the model.
2022-10-04 17:46:22,590 INFO input data is from pyramid. Its layout is set to NHWC
2022-10-04 17:46:22,796 INFO [Tue Oct  4 17:46:22 2022] End to quantize the model.
2022-10-04 17:46:22,962 INFO Saving the quantized model: yolov5s_672x672_nv12_quantized_model.onnx.
2022-10-04 17:46:23,495 INFO [Tue Oct  4 17:46:23 2022] Start to compile the model with march bernoulli2.
2022-10-04 17:46:23,743 INFO Compile submodel: torch-jit-export_subgraph_0
2022-10-04 17:46:24,120 INFO hbdk-cc parameters:['--fast', '--O3', '--input-layout', 'NHWC', '--output-layout', 'NHWC', '--input-source', 'pyramid']
2022-10-04 17:46:24,167 INFO INFO: "-j" or "--jobs" is not specified, launch 16 threads for optimization
2022-10-04 17:46:24,167 WARNING missing stride for pyramid input[0], use its aligned width by default.
[==================================================] 100%
2022-10-04 17:47:42,398 INFO consumed time 78.234
2022-10-04 17:47:42,572 INFO FPS=17.43, latency = 57387.6 us   (see torch-jit-export_subgraph_0.html)
2022-10-04 17:47:42,746 INFO [Tue Oct  4 17:47:42 2022] End to compile the model with march bernoulli2.
2022-10-04 17:47:42,748 INFO The converted model node information:
============================================================================================================================================
Node                                               ON   Subgraph  Type                       Cosine Similarity  Threshold                   
--------------------------------------------------------------------------------------------------------------------------------------------
HZ_PREPROCESS_FOR_data                             BPU  id(0)     HzSQuantizedPreprocess     1.000249           127.000000                  
Slice_4                                            BPU  id(0)     Slice                      0.999995           1.065925                    
Slice_9                                            BPU  id(0)     Slice                      0.999896           1.065925                    
Slice_14                                           BPU  id(0)     Slice                      0.999992           1.065925                    
Slice_19                                           BPU  id(0)     Slice                      0.999895           1.065925                    
Slice_24                                           BPU  id(0)     Slice                      0.999995           1.065925                    
Slice_29                                           BPU  id(0)     Slice                      0.999894           1.065925                    
Slice_34                                           BPU  id(0)     Slice                      0.999992           1.065925                    
Slice_39                                           BPU  id(0)     Slice                      0.999894           1.065925                    
Concat_40                                          BPU  id(0)     Concat                     1.000201           1.065925                    
Conv_41                                            BPU  id(0)     HzSQuantizedConv           1.000417           1.065925                    
LeakyRelu_43                                       BPU  id(0)     HzLeakyRelu                0.999315           9.565388                    
Conv_44                                            BPU  id(0)     HzSQuantizedConv           0.998291           9.565388                    
LeakyRelu_46                                       BPU  id(0)     HzLeakyRelu                0.998607           13.493938                   
Conv_47                                            BPU  id(0)     HzSQuantizedConv           0.999357           13.493938                   
LeakyRelu_49                                       BPU  id(0)     HzLeakyRelu                0.999475           4.795215                    
Conv_50                                            BPU  id(0)     HzSQuantizedConv           0.993676           4.795215                    
LeakyRelu_52                                       BPU  id(0)     HzLeakyRelu                0.997127           7.377336                    
Conv_53                                            BPU  id(0)     HzSQuantizedConv           0.995438           7.377336                    
LeakyRelu_55                                       BPU  id(0)     HzLeakyRelu                0.996490           12.893383                   
UNIT_CONV_FOR_Add_56                               BPU  id(0)     HzSQuantizedConv           0.997635           4.795215                    
Conv_57                                            BPU  id(0)     HzSQuantizedConv           0.993456           13.701491                   
Conv_58                                            BPU  id(0)     HzSQuantizedConv           0.995226           13.493938                   
Concat_59                                          BPU  id(0)     Concat                     0.994014           11.856925                   
LeakyRelu_61                                       BPU  id(0)     HzLeakyRelu                0.995508           11.856925                   
Conv_62                                            BPU  id(0)     HzSQuantizedConv           0.991005           11.856925                   
LeakyRelu_64                                       BPU  id(0)     HzLeakyRelu                0.993757           7.449783                    
Conv_65                                            BPU  id(0)     HzSQuantizedConv           0.990448           7.449783                    
LeakyRelu_67                                       BPU  id(0)     HzLeakyRelu                0.992342           7.031975                    
Conv_68                                            BPU  id(0)     HzSQuantizedConv           0.997501           7.031975                    
LeakyRelu_70                                       BPU  id(0)     HzLeakyRelu                0.998094           3.502887                    
Conv_71                                            BPU  id(0)     HzSQuantizedConv           0.994286           3.502887                    
LeakyRelu_73                                       BPU  id(0)     HzLeakyRelu                0.994844           6.069211                    
Conv_74                                            BPU  id(0)     HzSQuantizedConv           0.992879           6.069211                    
LeakyRelu_76                                       BPU  id(0)     HzLeakyRelu                0.993573           4.123940                    
UNIT_CONV_FOR_Add_77                               BPU  id(0)     HzSQuantizedConv           0.997019           3.502887                    
Conv_78                                            BPU  id(0)     HzSQuantizedConv           0.989430           5.291677                    
LeakyRelu_80                                       BPU  id(0)     HzLeakyRelu                0.985459           5.891102                    
Conv_81                                            BPU  id(0)     HzSQuantizedConv           0.989856           5.891102                    
LeakyRelu_83                                       BPU  id(0)     HzLeakyRelu                0.990840           7.603921                    
UNIT_CONV_FOR_Add_84                               BPU  id(0)     HzSQuantizedConv           0.995930           5.291677                    
Conv_85                                            BPU  id(0)     HzSQuantizedConv           0.992432           8.904430                    
LeakyRelu_87                                       BPU  id(0)     HzLeakyRelu                0.993280           5.469590                    
Conv_88                                            BPU  id(0)     HzSQuantizedConv           0.989034           5.469590                    
LeakyRelu_90                                       BPU  id(0)     HzLeakyRelu                0.990263           10.865228                   
UNIT_CONV_FOR_Add_91                               BPU  id(0)     HzSQuantizedConv           0.995579           8.904430                    
Conv_92                                            BPU  id(0)     HzSQuantizedConv           0.988808           13.730002                   
Conv_93                                            BPU  id(0)     HzSQuantizedConv           0.990489           7.031975                    
Concat_94                                          BPU  id(0)     Concat                     0.989560           7.262249                    
LeakyRelu_96                                       BPU  id(0)     HzLeakyRelu                0.990888           7.262249                    
Conv_97                                            BPU  id(0)     HzSQuantizedConv           0.993098           7.262249                    
LeakyRelu_99                                       BPU  id(0)     HzLeakyRelu                0.991211           5.496812                    
Conv_100                                           BPU  id(0)     HzSQuantizedConv           0.993583           5.496812                    
LeakyRelu_102                                      BPU  id(0)     HzLeakyRelu                0.991866           5.719972                    
Conv_103                                           BPU  id(0)     HzSQuantizedConv           0.995982           5.719972                    
LeakyRelu_105                                      BPU  id(0)     HzLeakyRelu                0.996843           2.621932                    
Conv_106                                           BPU  id(0)     HzSQuantizedConv           0.994463           2.621932                    
LeakyRelu_108                                      BPU  id(0)     HzLeakyRelu                0.994016           5.975686                    
Conv_109                                           BPU  id(0)     HzSQuantizedConv           0.995599           5.975686                    
LeakyRelu_111                                      BPU  id(0)     HzLeakyRelu                0.993798           3.731829                    
UNIT_CONV_FOR_Add_112                              BPU  id(0)     HzSQuantizedConv           0.995422           2.621932                    
Conv_113                                           BPU  id(0)     HzSQuantizedConv           0.994725           4.103075                    
LeakyRelu_115                                      BPU  id(0)     HzLeakyRelu                0.990147           5.049542                    
Conv_116                                           BPU  id(0)     HzSQuantizedConv           0.993896           5.049542                    
LeakyRelu_118                                      BPU  id(0)     HzLeakyRelu                0.992818           6.516913                    
UNIT_CONV_FOR_Add_119                              BPU  id(0)     HzSQuantizedConv           0.994551           4.103075                    
Conv_120                                           BPU  id(0)     HzSQuantizedConv           0.994880           7.711994                    
LeakyRelu_122                                      BPU  id(0)     HzLeakyRelu                0.990902           4.603847                    
Conv_123                                           BPU  id(0)     HzSQuantizedConv           0.992633           4.603847                    
LeakyRelu_125                                      BPU  id(0)     HzLeakyRelu                0.992069           10.031747                   
UNIT_CONV_FOR_Add_126                              BPU  id(0)     HzSQuantizedConv           0.994463           7.711994                    
Conv_127                                           BPU  id(0)     HzSQuantizedConv           0.992736           11.763662                   
Conv_128                                           BPU  id(0)     HzSQuantizedConv           0.992591           5.719972                    
Concat_129                                         BPU  id(0)     Concat                     0.992644           5.999934                    
LeakyRelu_131                                      BPU  id(0)     HzLeakyRelu                0.992431           5.999934                    
Conv_132                                           BPU  id(0)     HzSQuantizedConv           0.994696           5.999934                    
LeakyRelu_134                                      BPU  id(0)     HzLeakyRelu                0.991275           5.092212                    
Conv_135                                           BPU  id(0)     HzSQuantizedConv           0.995734           5.092212                    
LeakyRelu_137                                      BPU  id(0)     HzLeakyRelu                0.993229           4.080043                    
Conv_138                                           BPU  id(0)     HzSQuantizedConv           0.996398           4.080043                    
LeakyRelu_140                                      BPU  id(0)     HzLeakyRelu                0.997200           7.308180                    
MaxPool_141                                        BPU  id(0)     HzQuantizedMaxPool         0.998847           7.308180                    
MaxPool_142                                        BPU  id(0)     HzQuantizedMaxPool         0.999095           7.308180                    
MaxPool_143                                        BPU  id(0)     HzQuantizedMaxPool         0.999225           7.308180                    
Concat_144                                         BPU  id(0)     Concat                     0.998973           7.308180                    
Conv_145                                           BPU  id(0)     HzSQuantizedConv           0.997401           7.308180                    
LeakyRelu_147                                      BPU  id(0)     HzLeakyRelu                0.991993           3.540069                    
Conv_148                                           BPU  id(0)     HzSQuantizedConv           0.995313           3.540069                    
LeakyRelu_150                                      BPU  id(0)     HzLeakyRelu                0.991999           4.885417                    
Conv_151                                           BPU  id(0)     HzSQuantizedConv           0.993966           4.885417                    
LeakyRelu_153                                      BPU  id(0)     HzLeakyRelu                0.991915           4.912245                    
Conv_154                                           BPU  id(0)     HzSQuantizedConv           0.995375           4.912245                    
LeakyRelu_156                                      BPU  id(0)     HzLeakyRelu                0.991952           4.840213                    
Conv_157                                           BPU  id(0)     HzSQuantizedConv           0.993622           4.840213                    
Conv_158                                           BPU  id(0)     HzSQuantizedConv           0.993671           3.540069                    
Concat_159                                         BPU  id(0)     Concat                     0.993632           4.888761                    
LeakyRelu_161                                      BPU  id(0)     HzLeakyRelu                0.988410           4.888761                    
Conv_162                                           BPU  id(0)     HzSQuantizedConv           0.992833           4.888761                    
LeakyRelu_164                                      BPU  id(0)     HzLeakyRelu                0.986227           4.201017                    
Conv_165                                           BPU  id(0)     HzSQuantizedConv           0.990234           4.201017                    
LeakyRelu_167                                      BPU  id(0)     HzLeakyRelu                0.988071           5.000985                    
Resize_168                                         BPU  id(0)     HzQuantizedResizeUpsample  0.988088           5.000985                    
UNIT_CONV_FOR_505_0.039377834647894_TO_FUSE_SCALE  BPU  id(0)     HzSQuantizedConv                                                          
Concat_169                                         BPU  id(0)     Concat                     0.989407           5.000985                    
Conv_170                                           BPU  id(0)     HzSQuantizedConv           0.993669           5.000985                    
LeakyRelu_172                                      BPU  id(0)     HzLeakyRelu                0.993927           3.854206                    
Conv_173                                           BPU  id(0)     HzSQuantizedConv           0.993419           3.854206                    
LeakyRelu_175                                      BPU  id(0)     HzLeakyRelu                0.991511           4.369511                    
Conv_176                                           BPU  id(0)     HzSQuantizedConv           0.991438           4.369511                    
LeakyRelu_178                                      BPU  id(0)     HzLeakyRelu                0.991134           5.215519                    
Conv_179                                           BPU  id(0)     HzSQuantizedConv           0.989505           5.215519                    
Conv_180                                           BPU  id(0)     HzSQuantizedConv           0.989471           5.000985                    
Concat_181                                         BPU  id(0)     Concat                     0.989477           5.397383                    
LeakyRelu_183                                      BPU  id(0)     HzLeakyRelu                0.988263           5.397383                    
Conv_184                                           BPU  id(0)     HzSQuantizedConv           0.989288           5.397383                    
LeakyRelu_186                                      BPU  id(0)     HzLeakyRelu                0.985086           5.141273                    
Conv_187                                           BPU  id(0)     HzSQuantizedConv           0.989487           5.141273                    
LeakyRelu_189                                      BPU  id(0)     HzLeakyRelu                0.992006           6.019610                    
Resize_190                                         BPU  id(0)     HzQuantizedResizeUpsample  0.992025           6.019610                    
UNIT_CONV_FOR_470_0.047398507595062_TO_FUSE_SCALE  BPU  id(0)     HzSQuantizedConv                                                          
Concat_191                                         BPU  id(0)     Concat                     0.991818           6.019610                    
Conv_192                                           BPU  id(0)     HzSQuantizedConv           0.993551           6.019610                    
LeakyRelu_194                                      BPU  id(0)     HzLeakyRelu                0.996678           3.829432                    
Conv_195                                           BPU  id(0)     HzSQuantizedConv           0.994650           3.829432                    
LeakyRelu_197                                      BPU  id(0)     HzLeakyRelu                0.996992           3.844464                    
Conv_198                                           BPU  id(0)     HzSQuantizedConv           0.994258           3.844464                    
LeakyRelu_200                                      BPU  id(0)     HzLeakyRelu                0.996183           5.467257                    
Conv_201                                           BPU  id(0)     HzSQuantizedConv           0.991097           5.467257                    
Conv_202                                           BPU  id(0)     HzSQuantizedConv           0.991353           6.019610                    
Concat_203                                         BPU  id(0)     Concat                     0.991187           5.914804                    
LeakyRelu_205                                      BPU  id(0)     HzLeakyRelu                0.993002           5.914804                    
Conv_206                                           BPU  id(0)     HzSQuantizedConv           0.980396           5.914804                    
LeakyRelu_208                                      BPU  id(0)     HzLeakyRelu                0.983803           19.009319                   
Conv_209                                           BPU  id(0)     HzSQuantizedConv           0.981550           19.009319                   
LeakyRelu_211                                      BPU  id(0)     HzLeakyRelu                0.983346           6.489002                    
UNIT_CONV_FOR_568_0.051094502210617_TO_FUSE_SCALE  BPU  id(0)     HzSQuantizedConv                                                          
Concat_212                                         BPU  id(0)     Concat                     0.988376           6.489002                    
Conv_213                                           BPU  id(0)     HzSQuantizedConv           0.982762           6.489002                    
LeakyRelu_215                                      BPU  id(0)     HzLeakyRelu                0.982941           6.002916                    
Conv_216                                           BPU  id(0)     HzSQuantizedConv           0.983863           6.002916                    
LeakyRelu_218                                      BPU  id(0)     HzLeakyRelu                0.980998           5.994791                    
Conv_219                                           BPU  id(0)     HzSQuantizedConv           0.985687           5.994791                    
LeakyRelu_221                                      BPU  id(0)     HzLeakyRelu                0.985396           6.025105                    
Conv_222                                           BPU  id(0)     HzSQuantizedConv           0.981646           6.025105                    
Conv_223                                           BPU  id(0)     HzSQuantizedConv           0.985091           6.489002                    
Concat_224                                         BPU  id(0)     Concat                     0.983152           7.844817                    
LeakyRelu_226                                      BPU  id(0)     HzLeakyRelu                0.985835           7.844817                    
Conv_227                                           BPU  id(0)     HzSQuantizedConv           0.976176           7.844817                    
LeakyRelu_229                                      BPU  id(0)     HzLeakyRelu                0.977843           18.134787                   
Conv_230                                           BPU  id(0)     HzSQuantizedConv           0.980275           18.134787                   
LeakyRelu_232                                      BPU  id(0)     HzLeakyRelu                0.980287           6.185248                    
UNIT_CONV_FOR_538_0.048702739179134_TO_FUSE_SCALE  BPU  id(0)     HzSQuantizedConv                                                          
Concat_233                                         BPU  id(0)     Concat                     0.982942           6.185248                    
Conv_234                                           BPU  id(0)     HzSQuantizedConv           0.982924           6.185248                    
LeakyRelu_236                                      BPU  id(0)     HzLeakyRelu                0.982356           6.477486                    
Conv_237                                           BPU  id(0)     HzSQuantizedConv           0.979146           6.477486                    
LeakyRelu_239                                      BPU  id(0)     HzLeakyRelu                0.977248           8.212425                    
Conv_240                                           BPU  id(0)     HzSQuantizedConv           0.982827           8.212425                    
LeakyRelu_242                                      BPU  id(0)     HzLeakyRelu                0.980781           6.408384                    
Conv_243                                           BPU  id(0)     HzSQuantizedConv           0.977600           6.408384                    
Conv_244                                           BPU  id(0)     HzSQuantizedConv           0.984553           6.185248                    
Concat_245                                         BPU  id(0)     Concat                     0.980870           6.350356                    
LeakyRelu_247                                      BPU  id(0)     HzLeakyRelu                0.983271           6.350356                    
Conv_248                                           BPU  id(0)     HzSQuantizedConv           0.975667           6.350356                    
LeakyRelu_250                                      BPU  id(0)     HzLeakyRelu                0.978477           13.301773                   
Conv_251                                           BPU  id(0)     HzSQuantizedConv           0.999065           19.009319                   
Conv_253                                           BPU  id(0)     HzSQuantizedConv           0.999060           18.134787                   
Conv_255                                           BPU  id(0)     HzSQuantizedConv           0.999241           13.301773
2022-10-04 17:47:42,749 INFO [Tue Oct  4 17:47:42 2022] End to Horizon NN Model Convert.
2022-10-04 17:47:42,829 INFO start convert to *.bin file....
2022-10-04 17:47:42,873 INFO ONNX model output num : 3
2022-10-04 17:47:42,873 INFO ############# model deps info #############
2022-10-04 17:47:42,874 INFO hb_mapper version   : 1.9.9
2022-10-04 17:47:42,874 INFO hbdk version        : 3.37.2
2022-10-04 17:47:42,874 INFO hbdk runtime version: 3.14.14
2022-10-04 17:47:42,874 INFO horizon_nn version  : 0.14.0
2022-10-04 17:47:42,874 INFO ############# model_parameters info #############
2022-10-04 17:47:42,874 INFO onnx_model          : /open_explorer/ddk/samples/ai_toolchain/horizon_model_convert_sample/01_common/model_zoo/mapper/detection/yolov5_onnx_optimized/YOLOv5s.onnx
2022-10-04 17:47:42,874 INFO BPU march           : bernoulli2
2022-10-04 17:47:42,874 INFO layer_out_dump      : False
2022-10-04 17:47:42,874 INFO log_level           : DEBUG
2022-10-04 17:47:42,874 INFO working dir         : /open_explorer/ddk/samples/ai_toolchain/horizon_model_convert_sample/04_detection/03_yolov5s/mapper/model_output
2022-10-04 17:47:42,874 INFO output_model_file_prefix: yolov5s_672x672_nv12
2022-10-04 17:47:42,874 INFO ############# input_parameters info #############
2022-10-04 17:47:42,874 INFO ------------------------------------------
2022-10-04 17:47:42,874 INFO ---------input info : data ---------
2022-10-04 17:47:42,874 INFO input_name          : data
2022-10-04 17:47:42,874 INFO input_type_rt       : nv12
2022-10-04 17:47:42,875 INFO input_space&range   : regular
2022-10-04 17:47:42,875 INFO input_layout_rt     : None
2022-10-04 17:47:42,875 INFO input_type_train    : rgb
2022-10-04 17:47:42,875 INFO input_layout_train  : NCHW
2022-10-04 17:47:42,875 INFO norm_type           : data_scale
2022-10-04 17:47:42,875 INFO input_shape         : 1x3x672x672
2022-10-04 17:47:42,875 INFO scale_value         : 0.003921568627451,
2022-10-04 17:47:42,875 INFO cal_data_dir        : /open_explorer/ddk/samples/ai_toolchain/horizon_model_convert_sample/04_detection/03_yolov5s/mapper/calibration_data_rgb_f32
2022-10-04 17:47:42,875 INFO ---------input info : data end -------
2022-10-04 17:47:42,875 INFO ------------------------------------------
2022-10-04 17:47:42,875 INFO ############# calibration_parameters info #############
2022-10-04 17:47:42,875 INFO preprocess_on       : False
2022-10-04 17:47:42,875 INFO calibration_type:   : default
2022-10-04 17:47:42,875 INFO cal_data_type       : float32
2022-10-04 17:47:42,875 INFO ############# compiler_parameters info #############
2022-10-04 17:47:42,875 INFO hbdk_pass_through_params: --fast --O3
2022-10-04 17:47:42,875 INFO input-source        : {'data': 'pyramid', '_default_value': 'ddr'}
2022-10-04 17:47:42,884 INFO Convert to runtime bin file sucessfully!
2022-10-04 17:47:42,884 INFO End Model Convert

REF
https://developer.horizon.ai/forumDetail/107952931390742029

猜你喜欢

转载自blog.csdn.net/qq_35608277/article/details/127164307
x3