Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onnx转rknn报错 #221

Open
kuangcaomvp opened this issue Nov 28, 2024 · 2 comments
Open

onnx转rknn报错 #221

kuangcaomvp opened this issue Nov 28, 2024 · 2 comments

Comments

@kuangcaomvp
Copy link

今天尝试吧HIT模型转换成rknn的时候报了以下错误,请问是什么原因导致的
环境:
python 3.10
rknn-toolkit2 version: 2.3.0

报错信息如下:

--> Building model
D base_optimize ...
D base_optimize done.
D
D fold_constant ...
D fold_constant done.
D fold_constant remove nodes = ['/conv5_br/Conv', '/conv4_br/conv4_br.2/Relu', '/conv4_br/conv4_br.0/Conv', '/conv3_br/conv3_br.2/Relu', '/conv3_br/conv3_br.0/Conv', '/conv2_br/conv2_br.2/Relu', '/conv2_br/conv2_br.0/Conv', '/conv1_br/conv1_br.2/Relu', '/conv1_br/conv1_br.0/Conv', '/conv5_tl/Conv', '/conv4_tl/conv4_tl.2/Relu', '/conv4_tl/conv4_tl.0/Conv', '/conv3_tl/conv3_tl.2/Relu', '/conv3_tl/conv3_tl.0/Conv', '/conv2_tl/conv2_tl.2/Relu', '/conv2_tl/conv2_tl.0/Conv', '/conv1_tl/conv1_tl.2/Relu', '/conv1_tl/conv1_tl.0/Conv']
E build: All outputs ['tl', 'br'] of model are constants, The model is invalid!
Please check if the original model is valid?
W build: ===================== WARN(2) =====================
E rknn-toolkit2 version: 2.3.0
E build: Traceback (most recent call last):
File "rknn/api/rknn_log.py", line 344, in rknn.api.rknn_log.error_catch_decorator.error_catch_wrapper
File "rknn/api/rknn_base.py", line 1945, in rknn.api.rknn_base.RKNNBase.build
File "rknn/api/graph_optimizer.py", line 1103, in rknn.api.graph_optimizer.GraphOptimizer.fold_constant
File "rknn/api/rknn_log.py", line 95, in rknn.api.rknn_log.RKNNLog.e
ValueError: All outputs ['tl', 'br'] of model are constants, The model is invalid!
Please check if the original model is valid?

I ===================== WARN(0) =====================
E rknn-toolkit2 version: 2.3.0
Traceback (most recent call last):
File "rknn/api/rknn_log.py", line 344, in rknn.api.rknn_log.error_catch_decorator.error_catch_wrapper
File "rknn/api/rknn_base.py", line 1945, in rknn.api.rknn_base.RKNNBase.build
File "rknn/api/graph_optimizer.py", line 1103, in rknn.api.graph_optimizer.GraphOptimizer.fold_constant
File "rknn/api/rknn_log.py", line 95, in rknn.api.rknn_log.RKNNLog.e
ValueError: All outputs ['tl', 'br'] of model are constants, The model is invalid!
Please check if the original model is valid?

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/data/code/ostrack/rknn/hit_test/video_demo_rknn.py", line 343, in
main()
File "/data/code/ostrack/rknn/hit_test/video_demo_rknn.py", line 339, in main
run_video(args.tracker_path, args.videofile)
File "/data/code/ostrack/rknn/hit_test/video_demo_rknn.py", line 227, in run_video
ret = rknn.build(do_quantization=False, dataset=None)
File "/data/anaconda3/envs/py10/lib/python3.10/site-packages/rknn/api/rknn.py", line 192, in build
return self.rknn_base.build(do_quantization=do_quantization, dataset=dataset, expand_batch_size=rknn_batch_size)
File "rknn/api/rknn_log.py", line 349, in rknn.api.rknn_log.error_catch_decorator.error_catch_wrapper
File "rknn/api/rknn_log.py", line 95, in rknn.api.rknn_log.RKNNLog.e
ValueError: Traceback (most recent call last):
File "rknn/api/rknn_log.py", line 344, in rknn.api.rknn_log.error_catch_decorator.error_catch_wrapper
File "rknn/api/rknn_base.py", line 1945, in rknn.api.rknn_base.RKNNBase.build
File "rknn/api/graph_optimizer.py", line 1103, in rknn.api.graph_optimizer.GraphOptimizer.fold_constant
File "rknn/api/rknn_log.py", line 95, in rknn.api.rknn_log.RKNNLog.e
ValueError: All outputs ['tl', 'br'] of model are constants, The model is invalid!
Please check if the original model is valid?

image

fold_constant remove nodes是不是把不支持的节点给删除了 导致的 ?但是这些节点都是正常的conv和relu,有没有什么方法可以定位具体的报错信息

@kuangcaomvp
Copy link
Author

通过百度网盘分享的文件:VT_ep1500.onnx
链接:https://pan.baidu.com/s/1-Y6IQVei6ePrWwQsqiC3dA
提取码:r6ph
我的onnx

@scteam1994
Copy link

最后一个reshape,把batch固定成1试试

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants