[ONNXRuntimeError] : 2 : INVALID_ARGUMENT : Got invalid dimensions for input: image for the followin

项目场景:

onnx模型测试,遇到一下问题…


问题描述

ignificantly reduce device memory usage. See `CUDA_MODULE_LOADING` in https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#env-vars
Traceback (most recent call last):
  File "/home/lewele001/anaconda3/envs/Pipeline_py37/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/lewele001/anaconda3/envs/Pipeline_py37/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/lewele001/.vscode/extensions/ms-python.python-2022.18.2/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/__main__.py", line 39, in <module>
    cli.main()
  File "/home/lewele001/.vscode/extensions/ms-python.python-2022.18.2/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 430, in main
    run()
  File "/home/lewele001/.vscode/extensions/ms-python.python-2022.18.2/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 284, in run_file
    runpy.run_path(target, run_name="__main__")
  File "/home/lewele001/.vscode/extensions/ms-python.python-2022.18.2/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 322, in run_path
    pkg_name=pkg_name, script_name=fname)
  File "/home/lewele001/.vscode/extensions/ms-python.python-2022.18.2/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 136, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "/home/lewele001/.vscode/extensions/ms-python.python-2022.18.2/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 124, in _run_code
    exec(code, run_globals)
  File "/home/lewele001/work/code/deep_learn/dsm_dir/Pipeline/inference.py", line 53, in <module>
    stop_demo, img = demo(img, name , args.log, ts_ns)
  File "/home/lewele001/work/code/deep_learn/dsm_dir/Pipeline/pipeline.py", line 185, in __call__
    dets = self.detect(image)
  File "/home/lewele001/work/code/deep_learn/dsm_dir/Pipeline/detection/face_detector.py", line 44, in __call__
    onnx_outs = self.onnx_session.run(None, onnx_inputs)
  File "/home/lewele001/anaconda3/envs/Pipeline_py37/lib/python3.7/site-packages/onnxruntime/capi/onnxruntime_inference_collection.py", line 192, in run
    return self._sess.run(output_names, input_feed, run_options)
onnxruntime.capi.onnxruntime_pybind11_state.InvalidArgument: [ONNXRuntimeError] : 2 : INVALID_ARGUMENT : Got invalid dimensions for input: image for the following indices
 index: 2 Got: 270 Expected: 200
 index: 3 Got: 432 Expected: 320
 Please fix either the inputs or the model.
QLibraryPrivate::unload succeeded on "/home/lewele001/anaconda3/envs/Pipeline_py37/plugins/platforminputcontexts/libcomposeplatforminputcontextplugin.so" 
QLibraryPrivate::unload succeeded on "/home/lewele001/anaconda3/envs/Pipeline_py37/plugins/xcbglintegrations/libqxcb-glx-integration.so" 
QLibraryPrivate::unload succeeded on "/home/lewele001/anaconda3/envs/Pipeline_py37/plugins/platforms/libqxcb.so" 
QLibraryPrivate::unload succeeded on "Xcursor" (faked)
Unexpected Internal Error: [virtualMemoryBuffer.cpp::~StdVirtualMemoryBufferImpl::105] Error Code 1: Cuda Runtime (driver shutting down)
Unexpected Internal Error: [virtualMemoryBuffer.cpp::~StdVirtualMemoryBufferImpl::105] Error Code 1: Cuda Runtime (driver shutting down)

原因分析:

onnxruntime.capi.onnxruntime_pybind11_state.InvalidArgument: [ONNXRuntimeError] : 2 : INVALID_ARGUMENT : Got invalid dimensions for input: image for the following indices
index: 2 Got: 270 Expected: 200
index: 3 Got: 432 Expected: 320
Please fix either the inputs or the model.

这个错,意思很简单,意思是 onnx 模型的输入是

一个维度是270,一个维度是200,所以是INVALID ARGUMENT(无效的输入)

解决方案:

输入图像尺寸和模型不匹配,调整图片size,解决问你。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值