Toybrick

标题: Error converting tflite to rknn [打印本页]

作者: nicolausYes    时间: 2020-7-21 23:13
标题: Error converting tflite to rknn
本帖最后由 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    时间: 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 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    时间: 2020-7-23 01:46
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    时间: 2020-7-23 09:15
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.




欢迎光临 Toybrick (https://t.rock-chips.com/) Powered by Discuz! X3.3