[TOC]

概述

qnn-onnx-converter

执行脚本转化输出如下:

1
2
3
4
5
6
7
8
9
10
11
12
>>>> Step 1 : 执行 qnn-onnx-converter
2023-08-09 20:17:11,886 - 219 - WARNING - Couldn't import onnx-simplifier. (<class 'ModuleNotFoundError'>: No module named 'onnxsim')
2023-08-09 20:17:11,886 - 219 - WARNING - Install the onnx-simplifier for better model compatibility: "pip3 install onnx-simplifier"
2023-08-09 20:17:11,901 - 219 - WARNING - WARNING_OP_VERSION_NOT_SUPPORTED: Operation Constant Not Supported. Expected operator version: [1, 9], instead got version: [13]
// ......
2023-08-09 20:17:11,982 - 214 - INFO - Processed 0 quantization encodings
2023-08-09 20:17:12,169 - 214 - INFO - Skipping quantization, no input_list provided
2023-08-09 20:17:12,169 - 214 - INFO - Saving QNN Model...
2023-08-09 20:17:12,208 - 214 - INFO - Model CPP saved at: /home/baiduiov/work/vision-space/OriginalModel/FaceRect/20230809_单通道_首层融合_非量化/onnx/Result/QnnModel/float16/cpp/FaceDetection20230809V4Main_noquant.cpp
2023-08-09 20:17:12,208 - 214 - INFO - Model BIN saved at: /home/baiduiov/work/vision-space/OriginalModel/FaceRect/20230809_单通道_首层融合_非量化/onnx/Result/QnnModel/float16/cpp/FaceDetection20230809V4Main_noquant.bin
2023-08-09 20:17:12,220 - 214 - INFO - Model Network JSON saved at: /home/baiduiov/work/vision-space/OriginalModel/FaceRect/20230809_单通道_首层融合_非量化/onnx/Result/QnnModel/float16/cpp/FaceDetection20230809V4Main_noquant_net.json
2023-08-09 20:17:12,220 - 214 - INFO - Conversion complete!

qnn-context-binary-generator

1
2
>>>> Step 4 : 执行 qnn-context-binary-generator
qnn-context-binary-generator pid:23435

qnn-net-run

1
2
>>>> Step 6 : 执行 qnn-net-run
qnn-net-run pid:23445

Compare Onnx and Qnn model layer by layer

将ONNX模型的网络层输出的数据和QNN的模型输出的每层网络的数据进行意义对比

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
-- NET JSON FILE   = /home/baiduiov/work/vision-space/OriginalModel/FaceRect/20230809_单通道_首层融合_非量化/onnx/Result/QnnModel/float16/cpp/FaceDetection20230809V4Main_noquant_net.json
-- RESULT ONNX DIR = /home/baiduiov/work/vision-space/OriginalModel/FaceRect/20230809_单通道_首层融合_非量化/onnx/Result/OnnxResult/
-- RESULT QNN DIR = /home/baiduiov/work/vision-space/OriginalModel/FaceRect/20230809_单通道_首层融合_非量化/onnx/Result/QnnResult/Result_0/
Get Layer Names From Json File :
>> /home/baiduiov/work/vision-space/OriginalModel/FaceRect/20230809_单通道_首层融合_非量化/onnx/Result/QnnModel/float16/cpp/FaceDetection20230809V4Main_noquant_net.json
Cosine : 0.9999949932098389 -> conv2d_44_tmp_0.raw
Cosine : 0.9999957084655762 -> relu_0_tmp_0.raw
Cosine : 0.9999979138374329 -> pool2d_0_tmp_0.raw
Cosine : 0.9999985098838806 -> conv2d_45_tmp_0.raw
Cosine : 0.9999979734420776 -> relu_1_tmp_0.raw
Cosine : 0.9999979138374329 -> conv2d_46_tmp_0.raw
Cosine : 0.9999976754188538 -> elementwise_add_0.raw
Cosine : 0.9999978542327881 -> relu_2_tmp_0.raw
Cosine : 0.9999973177909851 -> conv2d_47_tmp_0.raw
Cosine : 0.9999972581863403 -> relu_3_tmp_0.raw
Cosine : 0.9999963641166687 -> conv2d_48_tmp_0.raw
Cosine : 0.9999958872795105 -> elementwise_add_1.raw
Cosine : 0.9999959468841553 -> relu_4_tmp_0.raw
Cosine : 0.9999963045120239 -> conv2d_49_tmp_0.raw
Cosine : 0.999997079372406 -> conv2d_50_tmp_0.raw
Cosine : 0.9999946355819702 -> relu_5_tmp_0.raw
Cosine : 0.9999942183494568 -> conv2d_51_tmp_0.raw
Cosine : 0.9999964237213135 -> elementwise_add_2.raw
Cosine : 0.999992847442627 -> relu_6_tmp_0.raw
Cosine : 0.9999952912330627 -> conv2d_52_tmp_0.raw
Cosine : 0.9999914169311523 -> relu_7_tmp_0.raw
Cosine : 0.9999919533729553 -> conv2d_53_tmp_0.raw
Cosine : 0.9999918937683105 -> elementwise_add_3.raw
Cosine : 0.9999892115592957 -> relu_8_tmp_0.raw
Cosine : 0.9999924302101135 -> conv2d_54_tmp_0.raw
Cosine : 0.9999935626983643 -> conv2d_55_tmp_0.raw
Cosine : 0.9999940991401672 -> relu_9_tmp_0.raw
Cosine : 0.999993622303009 -> conv2d_56_tmp_0.raw
Cosine : 0.9999946355819702 -> elementwise_add_4.raw
Cosine : 0.9999905824661255 -> relu_10_tmp_0.raw
Cosine : 0.9999954104423523 -> conv2d_57_tmp_0.raw
Cosine : 0.9999932646751404 -> relu_11_tmp_0.raw
Cosine : 0.9999956488609314 -> conv2d_58_tmp_0.raw
Cosine : 0.9999937415122986 -> elementwise_add_5.raw
Cosine : 0.999991238117218 -> relu_12_tmp_0.raw
Cosine : 0.999995768070221 -> conv2d_59_tmp_0.raw
Cosine : 0.9999963045120239 -> conv2d_60_tmp_0.raw
Cosine : 0.9999971985816956 -> relu_13_tmp_0.raw
Cosine : 0.9999966025352478 -> conv2d_61_tmp_0.raw
Cosine : 0.9999969005584717 -> elementwise_add_6.raw
Cosine : 0.9999975562095642 -> relu_14_tmp_0.raw
Cosine : 0.9999975562095642 -> conv2d_62_tmp_0.raw
Cosine : 0.999997615814209 -> relu_15_tmp_0.raw
Cosine : 0.999997615814209 -> conv2d_63_tmp_0.raw
Cosine : 0.9999971389770508 -> elementwise_add_7.raw
Cosine : 0.9999977946281433 -> relu_16_tmp_0.raw
Cosine : 0.9999990463256836 -> pool2d_1_tmp_0.raw
Cosine : 0.9999991655349731 -> pool2d_2_tmp_0.raw
Cosine : 0.999999463558197 -> pool2d_3_tmp_0.raw
Cosine : 0.9999989867210388 -> concat_0_tmp_0.raw
Cosine : 0.999997079372406 -> conv2d_64_tmp_0.raw
Cosine : 0.9999949932098389 -> leaky_relu_0_tmp_0.raw
Cosine : 0.9999960064888 -> conv2d_65_tmp_0.raw
Cosine : 0.9999964237213135 -> leaky_relu_1_tmp_0.raw
Cosine : 0.9999951124191284 -> depthwise_conv2d_0_tmp_0.raw
Cosine : 0.9999971389770508 -> leaky_relu_2_tmp_0.raw
Cosine : 0.9999969601631165 -> conv2d_66_tmp_0.raw
Cosine : 0.999998152256012 -> leaky_relu_3_tmp_0.raw
Cosine : 0.9999979734420776 -> depthwise_conv2d_1_tmp_0.raw
Cosine : 0.9999982118606567 -> leaky_relu_4_tmp_0.raw
Cosine : 0.9999991059303284 -> conv2d_67_tmp_0.raw
Cosine : 0.999998152256012 -> conv2d_68_tmp_0.raw
Cosine : 0.9999994039535522 -> leaky_relu_5_tmp_0.raw
Cosine : 0.9999960660934448 -> leaky_relu_6_tmp_0.raw
Cosine : 0.9999999403953552 -> conv2d_69_tmp_1.raw
Cosine : 0.9999959468841553 -> nearest_interp_v2_2_tmp_0.raw
Cosine : 0.9999943375587463 -> concat_1_tmp_0.raw
Cosine : 0.9999955892562866 -> conv2d_70_tmp_0.raw
Cosine : 0.9999968409538269 -> leaky_relu_7_tmp_0.raw
Cosine : 0.9999979734420776 -> depthwise_conv2d_2_tmp_0.raw
Cosine : 0.9999984502792358 -> leaky_relu_8_tmp_0.raw
Cosine : 0.9999967813491821 -> conv2d_71_tmp_0.raw
Cosine : 0.9999972581863403 -> leaky_relu_9_tmp_0.raw
Cosine : 0.9999979138374329 -> depthwise_conv2d_3_tmp_0.raw
Cosine : 0.9999983310699463 -> leaky_relu_10_tmp_0.raw
Cosine : 0.9999986290931702 -> conv2d_72_tmp_0.raw
Cosine : 0.9999968409538269 -> conv2d_73_tmp_0.raw
Cosine : 0.999998927116394 -> leaky_relu_11_tmp_0.raw
Cosine : 0.9999964237213135 -> leaky_relu_12_tmp_0.raw
Cosine : 0.9999997615814209 -> conv2d_74_tmp_1.raw
Cosine : 0.9999955296516418 -> nearest_interp_v2_3_tmp_0.raw
Cosine : 0.999993085861206 -> concat_2_tmp_0.raw
Cosine : 0.9999964833259583 -> conv2d_75_tmp_0.raw
Cosine : 0.9999969601631165 -> leaky_relu_13_tmp_0.raw
Cosine : 0.9999967217445374 -> depthwise_conv2d_4_tmp_0.raw
Cosine : 0.9999974966049194 -> leaky_relu_14_tmp_0.raw
Cosine : 0.9999955892562866 -> conv2d_76_tmp_0.raw
Cosine : 0.9999961853027344 -> leaky_relu_15_tmp_0.raw
Cosine : 0.9999963641166687 -> depthwise_conv2d_5_tmp_0.raw
Cosine : 0.9999966025352478 -> leaky_relu_16_tmp_0.raw
Cosine : 0.9999969005584717 -> conv2d_77_tmp_0.raw
Cosine : 0.9999963045120239 -> leaky_relu_17_tmp_0.raw
Cosine : 1.0000004768371582 -> conv2d_78_tmp_1.raw