Toybrick

楼主: jefferyzhang

rknn-toolkit & rknn-api for Toybrick

 

wanggang

新手上路

积分
24
发表于 2021-2-3 14:37:22 | 显示全部楼层
jefferyzhang 发表于 2021-2-3 08:34
大于等于1.5。
1.6还在测试版状态,会不断修改bug,模型非要1.6才能转换的过的可以试试 ...

thanks a lot
回复

使用道具 举报

lidd

新手上路

积分
31
发表于 2021-2-3 15:58:01 | 显示全部楼层
yolov3 的tensorflow pb模型 转 rknn模型报了以下错误 代码用的 rknn_convert 中提供的代码
--> Loading model...
C:\ProgramData\Anaconda3\envs\rk\lib\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)
E Catch exception when loading tensorflow model: D:\BaiduNetdiskDownload\RKNN-Toolkit\rknn-toolkit-v1.4.0\examples\rknn_convert\models\tensorflow\mobilenet-ssd\output_graph.pb!
E Traceback (most recent call last):
E   File "C:\ProgramData\Anaconda3\envs\rk\lib\site-packages\tensorflow\python\framework\importer.py", line 418, in import_graph_def
E     graph._c_graph, serialized, options)  # pylint: disable=protected-access
E tensorflow.python.framework.errors_impl.InvalidArgumentError: Input 0 of node IteratorGetNext was passed float from Iterator_out_0_placeholder:0 incompatible with expected resource.
E During handling of the above exception, another exception occurred:
E Traceback (most recent call last):
E   File "rknn\api\rknn_base.py", line 222, in rknn.api.rknn_base.RKNNBase.load_tensorflow
E   File "rknn\base\RKNNlib\converter\convert_tf.py", line 530, in rknn.base.RKNNlib.converter.convert_tf.convert_tf.pre_process
E   File "rknn\base\RKNNlib\converter\tensorflowloader.py", line 91, in rknn.base.RKNNlib.converter.tensorflowloader.TF_Graph_Preprocess.pre_proces
E   File "rknn\base\RKNNlib\converter\tensorflowloader.py", line 809, in rknn.base.RKNNlib.converter.tensorflowloader.TF_Graph_Preprocess.calc_2_const
E   File "rknn\base\RKNNlib\converter\tf_util.py", line 371, in rknn.base.RKNNlib.converter.tf_util.TFProto_Util.query_tensor
E   File "rknn\base\RKNNlib\converter\tf_util.py", line 372, in rknn.base.RKNNlib.converter.tf_util.TFProto_Util.query_tensor
E   File "C:\ProgramData\Anaconda3\envs\rk\lib\site-packages\tensorflow\python\util\deprecation.py", line 488, in new_func
E     return func(*args, **kwargs)
E   File "C:\ProgramData\Anaconda3\envs\rk\lib\site-packages\tensorflow\python\framework\importer.py", line 422, in import_graph_def
E     raise ValueError(str(e))
E ValueError: Input 0 of node IteratorGetNext was passed float from Iterator_out_0_placeholder:0 incompatible with expected resource.
Traceback (most recent call last):
  File "D:/BaiduNetdiskDownload/RKNN-Toolkit/rknn-toolkit-v1.4.0/examples/rknn_convert/rknn_convert.py", line 89, in <module>
    convert_model(model_path, out_path, pre_compile)
  File "D:/BaiduNetdiskDownload/RKNN-Toolkit/rknn-toolkit-v1.4.0/examples/rknn_convert/rknn_convert.py", line 72, in convert_model
    rknn.build(do_quantization=model['quantize'], dataset=dataset_path, pre_compile=pre_compile)
  File "C:\ProgramData\Anaconda3\envs\rk\lib\site-packages\rknn\api\rknn.py", line 231, in build
    inputs = self.rknn_base.net.get_input_layers()
AttributeError: 'NoneType' object has no attribute 'get_input_layers'
done
--> Build RKNN model...

Process finished with exit code 1
请问可能是什么问题啊
回复

使用道具 举报

banxia

注册会员

积分
87
发表于 2021-2-7 10:43:55 | 显示全部楼层
为什么1.6.0版本的api百度云链接是1.4.0的?
回复

使用道具 举报

jefferyzhang

版主

积分
12851
 楼主| 发表于 2021-2-7 10:50:19 | 显示全部楼层
banxia 发表于 2021-2-7 10:43
为什么1.6.0版本的api百度云链接是1.4.0的?

1.6还没正式发布,只能通过我们V3.0测试固件或者github下载使用。
回复

使用道具 举报

zhuyuliang0

中级会员

积分
355
发表于 2021-2-22 09:50:08 | 显示全部楼层
lidd 发表于 2021-2-3 15:58
yolov3 的tensorflow pb模型 转 rknn模型报了以下错误 代码用的 rknn_convert 中提供的代码
--> Loading mo ...

同问这个问题,目前遇到的是pytorch模型和onnx模型都是这个错误,yolov3的网络
回复

使用道具 举报

chenziyan

注册会员

积分
75
发表于 2021-2-25 17:46:43 | 显示全部楼层

rknn模型量化,出现问题:UnicodeDecodeError: 'utf-8' codec can't decode byte 0x93 in position 0: invalid start byte
ret = rknn.build(do_quantization=True, dataset='../prepare_dataset/dataset.npy')
其中dataset.npy是按照NHWC(100,64,32,6)格式保存的6通道图像数据,请问这种dataset的这种写法对吗?
回复

使用道具 举报

chenziyan

注册会员

积分
75
发表于 2021-2-25 18:23:35 | 显示全部楼层
rknn模型量化,出现问题:UnicodeDecodeError: 'utf-8' codec can't decode byte 0x93 in position 0: invalid start byte
ret = rknn.build(do_quantization=True, dataset='../prepare_dataset/dataset.npy')
其中dataset.npy是按照NHWC(100,64,32,6)格式保存的一个6通道图像数据,请问这种dataset的这种写法对吗?
回复

使用道具 举报

Lubagov

注册会员

积分
132
QQ
发表于 2021-3-2 03:13:59 | 显示全部楼层
I understand that you are not ASUS, but I just don't know where to ask questions. Although I do not exclude that you will ban me without answering:

In version 1.4 from your GitHub there is an example with SSD ssd.rknn. It works well with API 1.4.0, and version 1.3.2 of the NPU firmware, which is from ASUS.

1. Should it work, with firmware versions 1.4, 1.5, 1.6, (I found them in your repositories, and your firmwares). If I'm just flashing the NPU?

2. Do I need to convert the model again for the target API version and NPU firmware? Let's say ssd.rknn from API 1.4 if I'm using firmware 1.5 or 1.6. Do I need to convert the model using the appropriate RKNN-Toolkit? Or is it backward compatible?

3. Is there a possibility that your firmware for NPU, which is posted on Github, is not compatible with ASUS Tinker Edge R. After all, in principle, this is the same CPU, NPU?

4. Interestingly, if you look, the contents of `rootfs` from Debain, then there` librknn_api.so` has version 1.4. However, the NPU firmware is version 1.6. this is normal? I just don't see a newer version of lubrknn_api.so anywhere. Is it compatible? I saw in the answers that the API and driver versions should be the same.

So far, I was able to download this model, only in these versions, both on Android and Linux (librknn_api.so from your repositories / firmware, NPU firmware (driver) from ASUS):
D RKNNAPI: ============================================
D RKNNAPI: RKNN VERSION:
D RKNNAPI: API: 1.4.0 (bbe0dfc build: 2020-09-14 14:06:05)
D RKNNAPI: DRV: 1.3.2 (f113d64 build: 2020-04-23 09:35:26)
D RKNNAPI: ============================================
Otherwise, I have errors.

I really hope for an answer, thanks!
回复

使用道具 举报

jefferyzhang

版主

积分
12851
 楼主| 发表于 2021-3-2 09:35:02 | 显示全部楼层
Lubagov 发表于 2021-3-2 03:13
I understand that you are not ASUS, but I just don't know where to ask questions. Although I do not  ...

1. NPU firmware is mostly generic, but needs to match the version of rknntoolkit, (e.g. API 1.4.0 vs DRV 1.4.x, API 1.6.0 vs DRV 1.6.0). If the version does not match there may be many unknown problems.

2. Each version will have corresponding examples in rknn-toolkit.

3. All the firmwares for RK-NPUs could be find in github as below:
   https://github.com/rockchip-linux/rknpu-fw
   https://github.com/rockchip-linux/rknpu
   But they need agents(ASUS etc.) to integrate and test.

4. Version 1.6 is still in beta testing. Our toybrick-boards have released v3.0 debian test firmware for rknn-DRV1.6. We are not sure if other board vendors will update their firmware for the beta version
回复

使用道具 举报

marshorizon

注册会员

积分
71
发表于 2021-3-2 10:16:17 | 显示全部楼层
你好,keras模型转rknn失败,劳驾指点一下。
环境:Ubuntu x86 toolkit 1.6,  keras 2.2.4,python 3.6
load h5模型报错:

*************************
all device(s) with ntb mode:
TM018084201100261
*************************
([], ['TM018084201100261'])
**************************************************
E Catch exception when loading keras model: ./12net.h5!
E Traceback (most recent call last):
E   File "rknn/api/rknn_base.py", line 302, in rknn.api.rknn_base.RKNNBase.load_keras
E   File "rknn/base/RKNNlib/RK_nn.py", line 233, in rknn.base.RKNNlib.RK_nn.RKnn.load_keras
E   File "rknn/base/RKNNlib/app/importer/import_keras.py", line 202, in rknn.base.RKNNlib.app.importer.import_keras.ImportKeras.run
E   File "rknn/base/RKNNlib/app/importer/import_keras.py", line 154, in rknn.base.RKNNlib.app.importer.import_keras.ImportKeras.convert_engine_keras
E   File "rknn/base/RKNNlib/converter/convert_keras.py", line 23, in rknn.base.RKNNlib.converter.convert_keras.convert_keras.__init__
E   File "/home/rafe/work/venv/lib/python3.6/site-packages/tensorflow/python/keras/_impl/keras/engine/saving.py", line 239, in load_model
E     raise ValueError('No model found in config file.')
E ValueError: No model found in config file.
-1
回复

使用道具 举报

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

本版积分规则

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


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