Toybrick

rknn toolkit 1.2.1 example\ssd_mobilenet_v2 不能正常用

xsky

中级会员

积分
388
楼主
发表于 2019-12-12 21:25:16    查看: 8382|回复: 2 | [复制链接]    打印 | 只看该作者


1、 dataset.txt的列表与实际文件不符,目录下只有100张图片,txt中有200.
2、不使用混合量化,直接使用:

  1.         # pre-process config
  2.         print('--> config model')
  3.         rknn.config(channel_mean_value='127.5 127.5 127.5 128', reorder_channel='0 1 2', quantized_dtype='asymmetric_quantized-u8')
  4.         print('done')

  5.         # Load tflite model
  6.         print('--> Loading model')
  7.         ret = rknn.load_tensorflow(tf_pb='./ssd_mobilenet_v2.pb',
  8.                                    inputs=['FeatureExtractor/MobilenetV2/MobilenetV2/input'],
  9.                                    outputs=['concat_1', 'concat'],
  10.                                    input_size_list=[[300,300,3]],
  11.                                    predef_file=None)
  12.         if ret != 0:
  13.             print('Load model failed!')
  14.             exit(ret)
  15.         print('done')
  16.         
  17.         ret = rknn.build(do_quantization=True, dataset='dataset.txt', rknn_batch_size=1)
  18.         
  19.         rknn_file = 'ssd_mobilenet_v2.pb-def-quant.rknn'
  20.         print('export:', rknn_file, '...')
  21.         rknn.export_rknn(rknn_file)
复制代码


报错:

D RKNN output shape(output): (100 1917 1 4)
D Real output shape: (100, 1917, 1, 4)
I Build ssd_mobilenet_v2 complete.
I Running 1 iterations
Exception in thread Thread-1:
Traceback (most recent call last):
  File "D:\Program Files\Python\Python36\lib\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 65, in rknn.base.acuitylib.provider.text_provider.TextProvider.get_batch
  File "rknn\base\acuitylib\provider\base_provider.py", line 149, in rknn.base.acuitylib.provider.base_provider.BaseProvider._tensor_list_to_batch
  File "C:\Users\dm\AppData\Roaming\Python\Python36\site-packages\numpy\core\_asarray.py", line 85, in asarray
    return array(a, dtype, copy=False, order=order)
ValueError: could not broadcast input array from shape (300,300,3) into shape (300,300)

E Catch exception when building RKNN model!
E Traceback (most recent call last):
E   File "D:\Program Files\Python\Python36\lib\site-packages\tensorflow\python\client\session.py", line 1356, in _do_call
E     return fn(*args)
E   File "D:\Program Files\Python\Python36\lib\site-packages\tensorflow\python\client\session.py", line 1341, in _run_fn
E     options, feed_dict, fetch_list, target_list, run_metadata)
E   File "D:\Program Files\Python\Python36\lib\site-packages\tensorflow\python\client\session.py", line 1429, in _call_tf_sessionrun
E     run_metadata)
E tensorflow.python.framework.errors_impl.OutOfRangeError: 2 root error(s) found.
E   (0) Out of range: FIFOQueue '_0_fifo_queue' is closed and has insufficient elements (requested 1, current size 0)
E        [[{{node fifo_queue_Dequeue}}]]
E   (1) Out of range: FIFOQueue '_0_fifo_queue' is closed and has insufficient elements (requested 1, current size 0)
E        [[{{node fifo_queue_Dequeue}}]]
E        [[fifo_queue_Dequeue/_1]]
E 0 successful operations.
E 0 derived errors ignored.
E During handling of the above exception, another exception occurred:
E Traceback (most recent call last):
E   File "rknn\api\rknn_base.py", line 584, in rknn.api.rknn_base.RKNNBase.build
E   File "rknn\api\rknn_base.py", line 1424, in rknn.api.rknn_base.RKNNBase._quantize2
E   File "rknn\base\RKNNlib\app\medusa\quantization.py", line 95, 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 129, in rknn.base.RKNNlib.app.medusa.workspace.Workspace.run
E   File "rknn\base\RKNNlib\app\medusa\workspace.py", line 110, 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 "D:\Program Files\Python\Python36\lib\site-packages\tensorflow\python\client\session.py", line 950, in run
E     run_metadata_ptr)
E   File "D:\Program Files\Python\Python36\lib\site-packages\tensorflow\python\client\session.py", line 1173, in _run
E     feed_dict_tensor, options, run_metadata)
E   File "D:\Program Files\Python\Python36\lib\site-packages\tensorflow\python\client\session.py", line 1350, in _do_run
E     run_metadata)
E   File "D:\Program Files\Python\Python36\lib\site-packages\tensorflow\python\client\session.py", line 1370, in _do_call
E     raise type(e)(node_def, op, message)
E tensorflow.python.framework.errors_impl.OutOfRangeError: 2 root error(s) found.
E   (0) Out of range: FIFOQueue '_0_fifo_queue' is closed and has insufficient elements (requested 1, current size 0)
E        [[node fifo_queue_Dequeue (defined at D:\Program Files\Python\Python36\lib\site-packages\rknn\api\rknn.py:166) ]]
E   (1) Out of range: FIFOQueue '_0_fifo_queue' is closed and has insufficient elements (requested 1, current size 0)
E        [[node fifo_queue_Dequeue (defined at D:\Program Files\Python\Python36\lib\site-packages\rknn\api\rknn.py:166) ]]
E        [[fifo_queue_Dequeue/_1]]
E 0 successful operations.
E 0 derived errors ignored.
E Original stack trace for 'fifo_queue_Dequeue':
E   File "to_rknn.py", line 204, in <module>
E     ret = rknn.build(do_quantization=True, dataset='dataset.txt', rknn_batch_size=1)
E   File "D:\Program Files\Python\Python36\lib\site-packages\rknn\api\rknn.py", line 166, 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 "D:\Program Files\Python\Python36\lib\site-packages\tensorflow\python\ops\data_flow_ops.py", line 445, in dequeue
E     self._queue_ref, self._dtypes, name=name)
E   File "D:\Program Files\Python\Python36\lib\site-packages\tensorflow\python\ops\gen_data_flow_ops.py", line 4503, in queue_dequeue_v2
E     timeout_ms=timeout_ms, name=name)
E   File "D:\Program Files\Python\Python36\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 788, in _apply_op_helper
E     op_def=op_def)
E   File "D:\Program Files\Python\Python36\lib\site-packages\tensorflow\python\util\deprecation.py", line 507, in new_func
E     return func(*args, **kwargs)
E   File "D:\Program Files\Python\Python36\lib\site-packages\tensorflow\python\framework\ops.py", line 3616, in create_op
E     op_def=op_def)
E   File "D:\Program Files\Python\Python36\lib\site-packages\tensorflow\python\framework\ops.py", line 2005, in __init__
E     self._traceback = tf_stack.extract_stack()
export: ssd_mobilenet_v2.pb-def-quant.rknn ...
E RKNN model data is None, please load model first!
load rknn model failed



例子没测试通就放出来了么?





回复

使用道具 举报

jefferyzhang

版主

积分
13580
沙发
发表于 2019-12-13 09:12:45 | 只看该作者
1. 我们再次确认过,val2017目录下有200张图,请检查你自己下的全不全。
2. 这个报错的原因和图片数量没有关系,是因为里面有一张灰度图,只有1个channel的,把这张图片去掉就可以了。./val2017/000000007888.jpg从dataset.txt去掉
(后面版本放的例子里已经把这个去掉了)
回复

使用道具 举报

xsky

中级会员

积分
388
板凳
 楼主| 发表于 2019-12-13 09:36:28 | 只看该作者
jefferyzhang 发表于 2019-12-13 09:12
1. 我们再次确认过,val2017目录下有200张图,请检查你自己下的全不全。
2. 这个报错的原因和图片数量没有 ...

嗯 谢谢
回复

使用道具 举报

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

本版积分规则

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


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