# Load tensorflow model
print('--> Loading model')
ret = rknn.load_onnx(model = './vgg16-bn.onnx')
if ret != 0:
print('Load crnn_cnn failed! Ret = {}'.format(ret))
exit(ret)
print('done')
# Build model
print('--> Building model')
ret = rknn.build(do_quantization=True, dataset='/home/sysman/rknn/mv2/vggpic/dataset.txt')
if ret != 0:
print('Build crnn_cnn failed!')
exit(ret)
print('done')
# Export rknn model
print('--> Export RKNN model')
ret = rknn.export_rknn('./vgg.rknn')
if ret != 0:
print('Export crnn_cnn.rknn failed!')
exit(ret)
print('doneOKOK')
rknn.release()
出错部分:
。。。。。
D Quantize tensor @Conv_17_37:bias.
D Quantize tensor @Conv_14_40:bias.
D Quantize tensor @Conv_10_44:bias.
D Quantize tensor @Conv_7_47:bias.
D Quantize tensor @Conv_3_51:bias.
D Quantize tensor @Conv_0_54:bias.
I Clean.
D Optimizing network with qnt_single_transmit_quantize, align_quantize, broadcast_quantize, qnt_adjust_coef
D Quantize tensor(@MaxPool_43_11ut0) with tensor(@Relu_42_12ut0)
D Quantize tensor(@attach_Gemm_53/out0_0ut0) with tensor(@Gemm_53_1ut0)
[TRAINER]Quantization complete.
E Catch exception when building RKNN model!
T Traceback (most recent call last):
T File "rknn/api/rknn_base.py", line 498, in rknn.api.rknn_base.RKNNBase.build
T File "rknn/api/rknn_base.py", line 1071, in rknn.api.rknn_base.RKNNBase._quantize
T File "rknn/base/RKNNlib/app/tensorzone/quantization.py", line 151, in rknn.base.RKNNlib.app.tensorzone.quantization.Quantization.run
T File "rknn/base/RKNNlib/RKNNnet.py", line 341, in rknn.base.RKNNlib.RKNNnet.RKNNNet.save_data
T File "rknn/base/RKNNlib/RKNNnet.py", line 355, in rknn.base.RKNNlib.RKNNnet.RKNNNet._save_old_data
T File "rknn/base/RKNNlib/RKNNnet.py", line 363, in rknn.base.RKNNlib.RKNNnet.RKNNNet._save_old_data
T File "/usr/local/lib/python3.5/dist-packages/numpy/lib/npyio.py", line 511, in save
T pickle_kwargs=pickle_kwargs)
T File "/usr/local/lib/python3.5/dist-packages/numpy/lib/format.py", line 586, in write_array
T pickle.dump(array, fp, protocol=2, **pickle_kwargs)
T MemoryError