Toybrick

convet onnx model to rknn

NG1368

注册会员

积分
52
楼主
发表于 2020-4-21 03:35:02    查看: 8637|回复: 6 | [复制链接]    打印 | 只看该作者
h, I want to convert onnx model in https://github.com/Linzaer/Ultra-Light-Fast-Generic-Face-Detector-1MB/tree/master/models to rknn. in first step, when I run  ret = rknn.load_onnx(model = './version-RFB-320.onnx'), I face with this error:


/usr/local/lib/python3.6/site-packages/onnx_tf/common/handler_helper.py:73: UserWarning: Unknown op ConstantFill in domain `ai.onnx`.
  handler.ONNX_OP, handler.DOMAIN or "ai.onnx"))
/usr/local/lib/python3.6/site-packages/onnx_tf/common/handler_helper.py:73: UserWarning: Unknown op ConstantLike in domain `ai.onnx`.
  handler.ONNX_OP, handler.DOMAIN or "ai.onnx"))
/usr/local/lib/python3.6/site-packages/onnx_tf/common/handler_helper.py:73: UserWarning: Unknown op MeanVarianceNormalization in domain `ai.onnx`.
  handler.ONNX_OP, handler.DOMAIN or "ai.onnx"))
E Catch exception when loading onnx model: ./version-RFB-320.onnx!
E Traceback (most recent call last):
E File "rknn / api / rknn_base.py", line 345, in rknn.api.rknn_base.RKNNBase.load_onnx
E File "rknn / base / RKNNlib / converter / convert_onnx.py", line 1040, in rknn.base.RKNNlib.converter.convert_onnx.convert_onnx.match_paragraph_and_param
E File "rknn / base / RKNNlib / converter / convert_onnx.py", line 893, in rknn.base.RKNNlib.converter.convert_onnx.convert_onnx._onnx_try_match_ruler
E File "<string>", line 1, in <module>
E KeyError: 'Slice'





回复

使用道具 举报

jefferyzhang

版主

积分
13578
沙发
发表于 2020-4-21 08:36:42 | 只看该作者
本帖最后由 jefferyzhang 于 2020-4-21 08:40 编辑

It means the op 'Slice' is unsupported by rknn.
You need to change it or waiting for our implementation.

You have to update rknn-toolkit to the latest version, each new version will support more OPs.
After you trying the latest rknn-toolkit and find it is still unsupported, you can report it here with rknn-toolkit version number.
回复

使用道具 举报

NG1368

注册会员

积分
52
板凳
 楼主| 发表于 2020-4-21 15:12:07 | 只看该作者
jefferyzhang 发表于 2020-4-21 08:36
It means the op 'Slice' is unsupported by rknn.
You need to change it or waiting for our implementat ...

I downloaded rknn_toolkit-1.3.0-cp36-cp36m-linux_aarch64.whl for install rknn-toolkit-1.3.0. in but in installation occurred errors:

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复

使用道具 举报

jefferyzhang

版主

积分
13578
地板
发表于 2020-4-21 16:55:26 | 只看该作者
Fedora or debian10? If in debian10, just using 'pip3 install rknn'
回复

使用道具 举报

NG1368

注册会员

积分
52
5#
 楼主| 发表于 2020-4-21 19:12:00 | 只看该作者
jefferyzhang 发表于 2020-4-21 16:55
Fedora or debian10? If in debian10, just using 'pip3 install rknn'

I use from Fedora
回复

使用道具 举报

NG1368

注册会员

积分
52
6#
 楼主| 发表于 2020-4-21 22:27:19 | 只看该作者

please help me to solve this problem.
回复

使用道具 举报

NG1368

注册会员

积分
52
7#
 楼主| 发表于 2020-4-22 02:21:47 | 只看该作者
本帖最后由 NG1368 于 2020-4-22 02:25 编辑
NG1368 发表于 2020-4-21 22:27
please help me to solve this problem.

Finaly, I can resolve problems in installing rknn-toolkit 1.3.0 and installed it.
but again in loading onnx model , this error occurred:
[toybrick@localhost ONNX]$ python3 ModelTransform.py
D Save log info to: ./e.log
--> Loading model
/usr/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)
I Current ONNX Model use ir_version 4 opset_version 9
/usr/local/lib/python3.6/site-packages/onnx_tf/common/handler_helper.py:73: UserWarning: Unknown op ConstantFill in domain `ai.onnx`.
  handler.ONNX_OP, handler.DOMAIN or "ai.onnx"))
/usr/local/lib/python3.6/site-packages/onnx_tf/common/handler_helper.py:73: UserWarning: Unknown op ConstantLike in domain `ai.onnx`.
  handler.ONNX_OP, handler.DOMAIN or "ai.onnx"))
/usr/local/lib/python3.6/site-packages/onnx_tf/common/handler_helper.py:73: UserWarning: Unknown op MeanVarianceNormalization in domain `ai.onnx`.
  handler.ONNX_OP, handler.DOMAIN or "ai.onnx"))
D calc tensor shape of Reshape_428ut0 [[1, 160, 4]]
D calc tensor shape of Reshape_414ut0 [[1, 160, 2]]
D calc tensor shape of Reshape_342ut0 [[1, 3600, 4]]
D calc tensor shape of Reshape_458ut0 [[1, 60, 4]]
D calc tensor shape of Reshape_374ut0 [[1, 600, 2]]
D calc tensor shape of Reshape_328ut0 [[1, 3600, 2]]
D calc tensor shape of Reshape_446ut0 [[1, 60, 2]]
D calc tensor shape of Reshape_388ut0 [[1, 600, 4]]
D calc tensor shape of Concat_460ut0 [[1, 4420, 4]]
D calc tensor shape of Concat_459ut0 [[1, 4420, 2]]
D import clients finished
I build output layer attach_Softmax_scores:out0
I build output layer attach_Concat_boxes:out0
I Try match Concat_boxes:out0
I Match concat_2 [['Concat_boxes']] [['Concat']] to [['concat']]
I Try match Softmax_scores:out0
I Match r_softmax [['Softmax_scores']] [['Softmax']] to [['softmax']]
I Try match Sub_480:out0
I Match r_sub [['Sub_480']] [['Sub']] to [['subtract']]
I Try match Add_485:out0
I Match r_add [['Add_485']] [['Add']] to [['add']]
I Try match Concat_459:out0
I Match concat_4 [['Concat_459']] [['Concat']] to [['concat']]
I Try match Slice_476:out0
E Try match Slice_476:out0 failed, catch exception!
I ----------------Warning(0)----------------
E Catch exception when loading onnx model: ./ultralight.onnx!
E Traceback (most recent call last):
E   File "rknn/base/RKNNlib/converter/convert_onnx.py", line 1027, in rknn.base.RKNNlib.converter.convert_onnx.convert_onnx.match_paragraph_and_param
E   File "rknn/base/RKNNlib/converter/convert_onnx.py", line 877, in rknn.base.RKNNlib.converter.convert_onnx.convert_onnx._onnx_try_match_ruler
E   File "<string>", line 1, in <module>
E KeyError: 'Slice'
E During handling of the above exception, another exception occurred:
E Traceback (most recent call last):
E   File "rknn/api/rknn_base.py", line 472, in rknn.api.rknn_base.RKNNBase.load_onnx
E   File "rknn/base/RKNNlib/converter/convert_onnx.py", line 1066, in rknn.base.RKNNlib.converter.convert_onnx.convert_onnx.match_paragraph_and_param
E   File "/home/toybrick/.local/lib/python3.6/site-packages/rknn/base/RKNNlib/RKNNlog.py", line 327, in e
E     raise ValueError(msg)
E ValueError: Try match Slice_476:out0 failed, catch exception!
Load model failed!
回复

使用道具 举报

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

本版积分规则

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


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