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

运行示例出错:E Catch exception when setting inputs. #14

Open
BridgesK opened this issue Mar 11, 2024 · 4 comments
Open

运行示例出错:E Catch exception when setting inputs. #14

BridgesK opened this issue Mar 11, 2024 · 4 comments

Comments

@BridgesK
Copy link

错误信息如下,求大佬指点,用的是项目自带的模型,板子是orange pi 5 plus
E Catch exception when setting inputs.
E Catch exception when setting inputs.
E Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/rknnlite/api/rknn_lite.py", line 200, in inference
self.rknn_runtime.set_inputs(inputs, data_type, data_format, inputs_pass_through=inputs_pass_through)
File "rknnlite/api/rknn_runtime.py", line 1067, in rknnlite.api.rknn_runtime.RKNNRuntime.set_inputs
Exception: The input[0] need 4dims input, but 3dims input buffer feed.

E Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/rknnlite/api/rknn_lite.py", line 200, in inference
self.rknn_runtime.set_inputs(inputs, data_type, data_format, inputs_pass_through=inputs_pass_through)
File "rknnlite/api/rknn_runtime.py", line 1067, in rknnlite.api.rknn_runtime.RKNNRuntime.set_inputs
Exception: The input[0] need 4dims input, but 3dims input buffer feed.

E Catch exception when setting inputs.
E Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/rknnlite/api/rknn_lite.py", line 200, in inference
self.rknn_runtime.set_inputs(inputs, data_type, data_format, inputs_pass_through=inputs_pass_through)
File "rknnlite/api/rknn_runtime.py", line 1067, in rknnlite.api.rknn_runtime.RKNNRuntime.set_inputs
Exception: The input[0] need 4dims input, but 3dims input buffer feed.

E Catch exception when setting inputs.
E Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/rknnlite/api/rknn_lite.py", line 200, in inference
self.rknn_runtime.set_inputs(inputs, data_type, data_format, inputs_pass_through=inputs_pass_through)
File "rknnlite/api/rknn_runtime.py", line 1067, in rknnlite.api.rknn_runtime.RKNNRuntime.set_inputs
Exception: The input[0] need 4dims input, but 3dims input buffer feed.

E Catch exception when setting inputs.
E Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/rknnlite/api/rknn_lite.py", line 200, in inference
self.rknn_runtime.set_inputs(inputs, data_type, data_format, inputs_pass_through=inputs_pass_through)
File "rknnlite/api/rknn_runtime.py", line 1067, in rknnlite.api.rknn_runtime.RKNNRuntime.set_inputs
Exception: The input[0] need 4dims input, but 3dims input buffer feed.

Traceback (most recent call last):
File "/rknn-multi-threaded/main.py", line 35, in
frame, flag = pool.get()
File "/rknn-multi-threaded/rknnpool.py", line 54, in get
return fut.result(), True
File "/usr/lib/python3.10/concurrent/futures/_base.py", line 451, in result
return self.__get_result()
File "/usr/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
raise self._exception
File "/usr/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/rknn-multi-threaded/func.py", line 207, in myFunc
input0_data = outputs[0].reshape([3, -1]+list(outputs[0].shape[-2:]))
TypeError: 'NoneType' object is not subscriptable
root@orangepi5plus:/rknn-multi-threaded#

@leafqycc
Copy link
Owner

看起来是输入的格式不对,demo里面的是用opencv读取出来的帧,是三维的(height, width, channels),您的模型的输入是nchw还是nhwc的呢?可以尝试把输入的图片矩阵reshape看看()

@BridgesK
Copy link
Author

看起来是输入的格式不对,demo里面的是用opencv读取出来的帧,是三维的(height, width, channels),您的模型的输入是nchw还是nhwc的呢?可以尝试把输入的图片矩阵reshape看看()

模型用的是您项目里自带的呀,我没更改代码

@leafqycc
Copy link
Owner

看起来是输入的格式不对,demo里面的是用opencv读取出来的帧,是三维的(height, width, channels),您的模型的输入是nchw还是nhwc的呢?可以尝试把输入的图片矩阵reshape看看()

模型用的是您项目里自带的呀,我没更改代码

那应该是api版本不对,python我只写了1.4.0的demo,要装这个版本的库)
https://github.com/rockchip-linux/rknn-toolkit2/tree/v1.4.0

@BridgesK
Copy link
Author

看起来是输入的格式不对,demo里面的是用opencv读取出来的帧,是三维的(height, width, channels),您的模型的输入是nchw还是nhwc的呢?可以尝试把输入的图片矩阵reshape看看()

模型用的是您项目里自带的呀,我没更改代码

那应该是api版本不对,python我只写了1.4.0的demo,要装这个版本的库) https://github.com/rockchip-linux/rknn-toolkit2/tree/v1.4.0

我用的是1.6.0的版本,可能是这个原因,很感谢您的耐心回答,我明天用1.4.0的版本试一下

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