Toybrick

楼主: jefferyzhang

RK3399Pro入门教程(4)从Tensorflow.Keras到RKNN

xinzhiling111

注册会员

积分
177
发表于 2020-11-7 23:33:58 | 显示全部楼层
IndexError: list index out of range

E Catch exception when building RKNN model!
E Traceback (most recent call last):
E   File "/home/zl/.local/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1334, in _do_call
E     return fn(*args)
E   File "/home/zl/.local/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1319, in _run_fn
E     options, feed_dict, fetch_list, target_list, run_metadata)
E   File "/home/zl/.local/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1407, in _call_tf_sessionrun
E     run_metadata)
E tensorflow.python.framework.errors_impl.OutOfRangeError: FIFOQueue '_0_fifo_queue' is closed and has insufficient elements (requested 1, current size 0)
E          [[{{node fifo_queue_Dequeue}} = QueueDequeueV2[component_types=[DT_FLOAT], timeout_ms=-1, _device="/job:localhost/replica:0/task:0/device:CPU:0"](fifo_queue)]]
E During handling of the above exception, another exception occurred:
E Traceback (most recent call last):
Ubuntu16.04 pc上运行上面的代码生成模型,然后转换的时候rknn.build的时候提示这个错误,请问是哪的事?
回复

使用道具 举报

jefferyzhang

超级版主

积分
7063
 楼主| 发表于 2020-11-10 17:46:48 | 显示全部楼层
xinzhiling111 发表于 2020-11-7 23:33
IndexError: list index out of range

E Catch exception when building RKNN model!

建议加置顶帖官方RKNN群讨论
回复

使用道具 举报

xinzhiling111

注册会员

积分
177
发表于 2020-11-10 18:55:17 | 显示全部楼层
jefferyzhang 发表于 2020-11-10 17:46
建议加置顶帖官方RKNN群讨论

已加,多谢
回复

使用道具 举报

xinzhiling111

注册会员

积分
177
发表于 2020-11-11 12:44:58 | 显示全部楼层
jefferyzhang 发表于 2020-11-10 17:46
建议加置顶帖官方RKNN群讨论

请问能否提供下dataset.txt以及量化用的图片,我这边量化失败,应该是量化用的图片不对。可以的话,帮忙发到邮箱里面:454086991@qq.com
非常感谢!
回复

使用道具 举报

jefferyzhang

超级版主

积分
7063
 楼主| 发表于 2020-11-11 15:12:21 | 显示全部楼层
xinzhiling111 发表于 2020-11-11 12:44
请问能否提供下dataset.txt以及量化用的图片,我这边量化失败,应该是量化用的图片不对。可以的话,帮忙 ...

量化图片是你需要真实场景图片,量化过程就是个下采样过程
回复

使用道具 举报

xinzhiling111

注册会员

积分
177
发表于 2020-11-12 09:08:47 | 显示全部楼层
jefferyzhang 发表于 2020-11-11 15:12
量化图片是你需要真实场景图片,量化过程就是个下采样过程

嗯,之前的量化图片是从mnist数据集里面取出来的jpg图片,量化总是失败,后来群里建议jpg改成npy,我试了下,可以转换模型了,但是转换之后,rknn.init_runtime()又崩溃了:
D [print_tensor:136]out(0): id[   8] vtl[1] const[0] shape[ 10               ] fmt[u8 ] qnt[ASM zp=157, scale=32.828148]
D [setup_node:368]Setup node id[3] uid[2] op[SOFTMAX]
D [print_tensor:136]in(0) : id[   8] vtl[1] const[0] shape[ 10               ] fmt[u8 ] qnt[ASM zp=157, scale=32.828148]
D [print_tensor:136]out(0): id[   0] vtl[0] const[0] shape[ 10, 1            ] fmt[f16] qnt[NONE]
D [optimize_node:312]Backward optimize neural network
D [optimize_node:319]Forward optimize neural network
D [rknn_optimize_internal_node:331]Optimize node uid[2] sub_uid[1] op[SOFTMAX_INTERNAL]
I [compute_node:261]Create vx node

Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)
这个信息发群里也没有人碰到过,提示信息只能看出好像是有地方内存溢出等,但是没法排查了。版主碰到过吗?或者有什么方式进一步排查下吗?
谢谢
回复

使用道具 举报

李雪梅

注册会员

积分
63
发表于 2020-11-24 14:49:48 | 显示全部楼层
本帖最后由 李雪梅 于 2020-11-24 14:50 编辑

依据转换为RKNN模型代码我的会出现如下报错,请楼主赐教:
xml@xml-vm:~/project/rk3399ProD/RK3399Pro入门教程(4)$ python3 tf_pb-to-rknn.py
--> config model
done
--> Loading model
/home/xml/.local/lib/python3.6/site-packages/onnx_tf/common/__init__.py:87: UserWarning: FrontendHandler.get_outputs_names is deprecated. It will be removed in future release.. Use node.outputs instead.
  warnings.warn(message)
done
--> Building model
W The channel_mean_value filed will not be used in the future!
W The channel_mean_value of input 0 is not support, ignore it!
E Catch exception when building RKNN model!
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "rknn/base/acuitylib/provider/queue_provider.py", line 98, in rknn.base.acuitylib.provider.queue_provider.QueueProvider.run
  File "rknn/base/acuitylib/provider/queue_provider.py", line 102, in rknn.base.acuitylib.provider.queue_provider.QueueProvider.run
  File "rknn/base/acuitylib/provider/text_provider.py", line 46, in rknn.base.acuitylib.provider.text_provider.TextProvider.get_batch
  File "rknn/base/acuitylib/provider/file_path_provider.py", line 98, in rknn.base.acuitylib.provider.file_path_provider.FilePathProvider._data_to_tensor
  File "rknn/base/acuitylib/provider/file_path_provider.py", line 110, in rknn.base.acuitylib.provider.file_path_provider.FilePathProvider._fitting_scale
IndexError: list index out of range

E Traceback (most recent call last):
E   File "/home/xml/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1278, in _do_call
E     return fn(*args)
E   File "/home/xml/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1263, in _run_fn
E     options, feed_dict, fetch_list, target_list, run_metadata)
E   File "/home/xml/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1350, in _call_tf_sessionrun
E     run_metadata)
E tensorflow.python.framework.errors_impl.OutOfRangeError: FIFOQueue '_0_fifo_queue' is closed and has insufficient elements (requested 1, current size 0)
E          [[Node: fifo_queue_Dequeue = QueueDequeueV2[component_types=[DT_FLOAT], timeout_ms=-1, _device="/job:localhost/replica:0/task:0/device:CPU:0"](fifo_queue)]]
E During handling of the above exception, another exception occurred:
E Traceback (most recent call last):
E   File "rknn/api/rknn_base.py", line 895, in rknn.api.rknn_base.RKNNBase.build
E   File "rknn/api/rknn_base.py", line 1797, in rknn.api.rknn_base.RKNNBase._quantize2
E   File "rknn/base/RKNNlib/app/medusa/quantization.py", line 105, in rknn.base.RKNNlib.app.medusa.quantization.Quantization.run
E   File "rknn/base/RKNNlib/app/medusa/quantization.py", line 44, in rknn.base.RKNNlib.app.medusa.quantization.Quantization._run_quantization
E   File "rknn/base/RKNNlib/app/medusa/workspace.py", line 145, in rknn.base.RKNNlib.app.medusa.workspace.Workspace.run
E   File "rknn/base/RKNNlib/app/medusa/workspace.py", line 126, in rknn.base.RKNNlib.app.medusa.workspace.Workspace._run_iteration
E   File "rknn/base/RKNNlib/RKNN_session.py", line 30, in rknn.base.RKNNlib.RKNN_session.RKNNSession.run
E   File "/home/xml/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 877, in run
E     run_metadata_ptr)
E   File "/home/xml/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1100, in _run
E     feed_dict_tensor, options, run_metadata)
E   File "/home/xml/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1272, in _do_run
E     run_metadata)
E   File "/home/xml/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1291, in _do_call
E     raise type(e)(node_def, op, message)
E tensorflow.python.framework.errors_impl.OutOfRangeError: FIFOQueue '_0_fifo_queue' is closed and has insufficient elements (requested 1, current size 0)
E          [[Node: fifo_queue_Dequeue = QueueDequeueV2[component_types=[DT_FLOAT], timeout_ms=-1, _device="/job:localhost/replica:0/task:0/device:CPU:0"](fifo_queue)]]
E Caused by op 'fifo_queue_Dequeue', defined at:
E   File "tf_pb-to-rknn.py", line 28, in <module>
E     ret = rknn.build(do_quantization=True, dataset='./dataset.txt')  # 量化模型
E   File "/home/xml/.local/lib/python3.6/site-packages/rknn/api/rknn.py", line 249, in build
E     ret = self.rknn_base.build(do_quantization=do_quantization, dataset=dataset, pack_vdata=pre_compile, batch_size=rknn_batch_size)
E   File "/home/xml/.local/lib/python3.6/site-packages/tensorflow/python/ops/data_flow_ops.py", line 433, in dequeue
E     self._queue_ref, self._dtypes, name=name)
E   File "/home/xml/.local/lib/python3.6/site-packages/tensorflow/python/ops/gen_data_flow_ops.py", line 3734, in queue_dequeue_v2
E     timeout_ms=timeout_ms, name=name)
E   File "/home/xml/.local/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
E     op_def=op_def)
E   File "/home/xml/.local/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 454, in new_func
E     return func(*args, **kwargs)
E   File "/home/xml/.local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3155, in create_op
E     op_def=op_def)
E   File "/home/xml/.local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1717, in __init__
E     self._traceback = tf_stack.extract_stack()
E OutOfRangeError (see above for traceback): FIFOQueue '_0_fifo_queue' is closed and has insufficient elements (requested 1, current size 0)
E          [[Node: fifo_queue_Dequeue = QueueDequeueV2[component_types=[DT_FLOAT], timeout_ms=-1, _device="/job:localhost/replica:0/task:0/device:CPU:0"](fifo_queue)]]
Build model failed!
xml@xml-vm:~/project/rk3399ProD/RK3399Pro入门教程(4)$
回复

使用道具 举报

jefferyzhang

超级版主

积分
7063
 楼主| 发表于 2020-11-24 14:59:18 | 显示全部楼层
本帖最后由 jefferyzhang 于 2020-11-24 15:03 编辑
李雪梅 发表于 2020-11-24 14:49
依据转换为RKNN模型代码我的会出现如下报错,请楼主赐教:
xml@xml-vm:~/project/rk3399ProD/RK3399Pro入门 ...

tf版本不对把? 自己先调试下吧,就这么几行代码而已。至少得先保证自己写的tensorflow存pb,然后再读出来用tensorflow能推理,然后才有rknn的事儿。。
回复

使用道具 举报

cfan

注册会员

积分
134
发表于 2020-12-16 16:38:21 | 显示全部楼层
请问一下我用TensorFlow生成的PB文件只有一层输出层是为什么?或者可以怎么解决?
回复

使用道具 举报

戈好雨

新手上路

积分
32
发表于 7 天前 | 显示全部楼层
rknn读取pb模型失败 按照教程流程得到pb模型后 转换过程中rknn.load_tensorflow = -1,读取失败使得进程被exit(-1),
tf=1.14
rknn=1.6
os=debian10
python=3.7
报错信息:
--> Loading model
I Start importing tensorflow...
E Catch exception when loading tensorflow model: /home/toybrick/codes/model.pb!
E Traceback (most recent call last):
E   File "rknn/api/rknn_base.py", line 209, in rknn.api.rknn_base.RKNNBase.load_tensorflow
E   File "rknn/base/RKNNlib/RK_nn.py", line 47, in rknn.base.RKNNlib.RK_nn.RKnn.load_tensorflow
E   File "rknn/base/RKNNlib/app/importer/import_tensorflow.py", line 58, in rknn.base.RKNNlib.app.importer.import_tensorflow.Importensorflow.run
E   File "rknn/base/RKNNlib/app/importer/import_tensorflow.py", line 53, in rknn.base.RKNNlib.app.importer.import_tensorflow.Importensorflow.import_tf_ruler_module
E   File "/home/toybrick/.local/lib/python3.7/site-packages/rknn/base/RKNNlib/converter/tfruler/__init__.py", line 2, in <module>
E     from .tf_ruler_generate import r_add_n_template, r_concatv2_template, r_split_template
E ImportError: cannot import name 'r_add_n_template' from 'tfruler.tf_ruler_generate' (/home/toybrick/.local/lib/python3.7/site-packages/rknn/base/RKNNlib/converter/tfruler/tf_ruler_generate.cpython-37m-aarch64-linux-gnu.so)
Load mtcnn failed! Ret = -1
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

产品中心 购买渠道 开源社区 Wiki教程 资料下载 关于Toybrick


快速回复 返回顶部 返回列表