wutianze / dnndk-pynqz2

First lesson for you to use DNNDK, also it can be helpful for your AI learning
64 stars 26 forks source link

模型量化 #13

Closed wsnnnn closed 3 years ago

wsnnnn commented 3 years ago

您好!我想请教一下。我用yolov3得到一个230M的.h5文件,然后转成.pb也是230M,但是用dencent_q量化后,还是230M。按道理说,这个8bit量化后,模型不应该减小吗?我用这个量化后的230M的模型扔给DNNDK,报错了BACKEND][Check Failed: (shift_write >= -7) && (shift_write <= 7)][/tmp/DNNDK_Pipeline_dnnc/dnnc/submodules/asicv2comc/Operator/OperatorElew.cpp:63][DATA_OUTRANGE][Data value is out of range!]

wutianze commented 3 years ago

看这个样子感觉是量化过程有问题,可以检查一下decent_q打印的内容。另外也要看一下模型的输入是否配置正确

------------------ Original ------------------ From:  "notifications";<notifications@github.com>; Send time: Wednesday, Nov 11, 2020 9:35 PM To: "wutianze/dnndk-pynqz2"<dnndk-pynqz2@noreply.github.com>; Cc: "Subscribed"<subscribed@noreply.github.com>; Subject:  [wutianze/dnndk-pynqz2] 模型量化 (#13)

您好!我想请教一下。我用yolov3得到一个230M的.h5文件,然后转成.pb也是230M,但是用dencent_q量化后,还是230M。按道理说,这个8bit量化后,模型不应该减小吗?我用这个量化后的230M的模型扔给DNNDK,报错了BACKEND][Check Failed: (shift_write >= -7) && (shift_write <= 7)][/tmp/DNNDK_Pipeline_dnnc/dnnc/submodules/asicv2comc/Operator/OperatorElew.cpp:63][DATA_OUTRANGE][Data value is out of range!]

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

wsnnnn commented 3 years ago

input_1

conv2d_1/kernel

conv2d_1/kernel/read

conv2d_1/convolution 上面是模型前面的输入节点,下面是我的量化 decent_q quantize \ --input_frozen_graph "./YOLO/PB/cur.pb" \ --input_nodes input_1 \ --input_shapes ?,512,512,3 \ --output_nodes 'conv2d_59/BiasAdd','conv2d_67/BiasAdd','conv2d_75/BiasAdd' \ --method 1 \ --input_fn graph_input_fn.calib_input \ --gpu 0 \ --calib_iter 100 也出来结果了,中间也没出警告什么的.我看了和你的quan.sh不太一样,是我的输入输出节点写错了吗?

wutianze commented 3 years ago

根据decent_q给出的输入输出节点来填quant.sh,另外你的graph_input_fn文件也要自己构造