Toybrick

Error converting tflite to rknn

nicolausYes

新手上路

积分
26
楼主
发表于 2020-7-21 23:13:35    查看: 7349|回复: 3 | [复制链接]    打印 | 只看该作者
本帖最后由 nicolausYes 于 2020-7-22 05:17 编辑

I experience errors while converting tflite models to rknn using RKNN-Toolkit 1.3.2.

While converting tflite 1.14 model:
--> Loading model
E Catch exception when loading tflite model: ./supercombo_1.14.tflite!
E Traceback (most recent call last):
E   File "rknn/api/rknn_base.py", line 396, in rknn.api.rknn_base.RKNNBase.load_tflite
E   File "rknn/base/RKNNlib/converter/tflite_loader.py", line 75, in rknn.base.RKNNlib.converter.tflite_loader.TFLiteLoader.load
E   File "rknn/base/RKNNlib/converter/tflite_loader.py", line 396, in rknn.base.RKNNlib.converter.tflite_loader.ModelParser.parse
E   File "rknn/base/RKNNlib/converter/tflite_loader.py", line 342, in rknn.base.RKNNlib.converter.tflite_loader.ModelParser._build_layers
E   File "rknn/base/RKNNlib/converter/tflite_loader.py", line 238, in rknn.base.RKNNlib.converter.tflite_loader.ModelParser._get_layer_RKNN_op
E   File "rknn/base/RKNNlib/converter/lite/RKNN_map_op.py", line 510, in rknn.base.RKNNlib.converter.lite.RKNN_map_op.RKNNMapOp.map_RKNN_ops
E   File "rknn/base/RKNNlib/converter/lite/RKNN_map_op.py", line 275, in rknn.base.RKNNlib.converter.lite.RKNN_map_op._permute
E   File "rknn/base/RKNNlib/converter/lite/utils.py", line 180, in rknn.base.RKNNlib.converter.lite.utils.get_builtin_options
E   File "rknn/base/RKNNlib/converter/lite/utils.py", line 174, in rknn.base.RKNNlib.converter.lite.utils.get_builtin_options_type
E AttributeError: module 'RKNNlib.converter.lite.tflite' has no attribute 'TransposeOptions'
Load failed!

While converting tflite 2.1 model:
--> Loading model
E Catch exception when loading tflite model: ./supercombo_2.1.tflite!
E Traceback (most recent call last):
E   File "rknn/api/rknn_base.py", line 396, in rknn.api.rknn_base.RKNNBase.load_tflite
E   File "rknn/base/RKNNlib/converter/tflite_loader.py", line 75, in rknn.base.RKNNlib.converter.tflite_loader.TFLiteLoader.load
E   File "rknn/base/RKNNlib/converter/tflite_loader.py", line 396, in rknn.base.RKNNlib.converter.tflite_loader.ModelParser.parse
E   File "rknn/base/RKNNlib/converter/tflite_loader.py", line 342, in rknn.base.RKNNlib.converter.tflite_loader.ModelParser._build_layers
E   File "rknn/base/RKNNlib/converter/tflite_loader.py", line 238, in rknn.base.RKNNlib.converter.tflite_loader.ModelParser._get_layer_RKNN_op
E   File "rknn/base/RKNNlib/converter/lite/RKNN_map_op.py", line 510, in rknn.base.RKNNlib.converter.lite.RKNN_map_op.RKNNMapOp.map_RKNN_ops
E   File "rknn/base/RKNNlib/converter/lite/RKNN_map_op.py", line 276, in rknn.base.RKNNlib.converter.lite.RKNN_map_op._permute
E AttributeError: 'NoneType' object has no attribute 'PermAsNumpy'
Load failed!

I can't use lower version than 1.14, because ELU operation was introduced in tensorflow 1.14.

Attachment includes:
supercombo.keras-original model.
supercombo_1.14.tflite – tflite model converted with tensorflow 1.14.
supercombo_2.1.tflite – tflite model converted with tensorflow 2.1.
convert2.py – python script to convert tflite to rknn.
https://1drv.ms/u/s!Ai_yk0dieAUPgytiDDqvlv4hwS4b?e=TXUl1V
回复

使用道具 举报

jefferyzhang

版主

积分
13580
沙发
发表于 2020-7-22 08:44:51 | 只看该作者
You have to wait a new version of rknntoolkit for support TF2.x which is in our roadmap ...
It's only support tf1.13.x in current version and some OPs  in tf1.14 (many OPs named xxxV2 xxxxV3 xxxV4 in higher version than 1.13 )
回复

使用道具 举报

nicolausYes

新手上路

积分
26
板凳
 楼主| 发表于 2020-7-23 01:46:12 | 只看该作者
jefferyzhang 发表于 2020-7-22 08:44
You have to wait a new version of rknntoolkit for support TF2.x which is in our roadmap ...
It's onl ...

Do you have an estimate on when 2.x will be supported?
回复

使用道具 举报

jefferyzhang

版主

积分
13580
地板
发表于 2020-7-23 09:15:13 | 只看该作者
nicolausYes 发表于 2020-7-23 01:46
Do you have an estimate on when 2.x will be supported?

Sorry, I don't know that, I'm not a member of the NPU team.
回复

使用道具 举报

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

本版积分规则

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


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