DefTruth / lite.ai.toolkit

🛠 A lite C++ toolkit of awesome AI models, support ONNXRuntime, MNN, TNN, NCNN and TensorRT.
https://github.com/DefTruth/lite.ai.toolkit
GNU General Public License v3.0
3.62k stars 691 forks source link

window10下使用vs2019调用OnnxRuntime.dll时出错! #195

Closed wwwsctvcom closed 2 years ago

wwwsctvcom commented 2 years ago

报错信息1 'lite_yolox_v0.1.1.exe' (Win32): Loaded 'D:\clion_workspace\lite.ai.toolkit-main\build\lite.ai.toolkit\bin\lite_yolox_v0.1.1.exe'. Symbols loaded. 'lite_yolox_v0.1.1.exe' (Win32): Loaded 'C:\Windows\System32\ntdll.dll'. 'lite_yolox_v0.1.1.exe' (Win32): Loaded 'C:\Windows\System32\kernel32.dll'. 'lite_yolox_v0.1.1.exe' (Win32): Loaded 'C:\Windows\System32\KernelBase.dll'. 'lite_yolox_v0.1.1.exe' (Win32): Loaded 'C:\Program Files\CyberArk\Endpoint Privilege Manager\Agent\x64\vf_inj.dll'. 'lite_yolox_v0.1.1.exe' (Win32): Loaded 'C:\Windows\System32\user32.dll'. 'lite_yolox_v0.1.1.exe' (Win32): Loaded 'C:\Windows\System32\win32u.dll'. 'lite_yolox_v0.1.1.exe' (Win32): Loaded 'C:\Windows\System32\gdi32.dll'. 'lite_yolox_v0.1.1.exe' (Win32): Loaded 'C:\Windows\System32\gdi32full.dll'. 'lite_yolox_v0.1.1.exe' (Win32): Loaded 'C:\Windows\System32\msvcp_win.dll'. 'lite_yolox_v0.1.1.exe' (Win32): Loaded 'C:\Windows\System32\ucrtbase.dll'. 'lite_yolox_v0.1.1.exe' (Win32): Loaded 'C:\Windows\System32\advapi32.dll'. 'lite_yolox_v0.1.1.exe' (Win32): Loaded 'C:\Windows\System32\msvcrt.dll'. 'lite_yolox_v0.1.1.exe' (Win32): Loaded 'C:\Windows\System32\sechost.dll'. 'lite_yolox_v0.1.1.exe' (Win32): Loaded 'C:\Windows\System32\rpcrt4.dll'. 'lite_yolox_v0.1.1.exe' (Win32): Loaded 'C:\Windows\System32\ole32.dll'. 'lite_yolox_v0.1.1.exe' (Win32): Loaded 'C:\Windows\System32\combase.dll'. 'lite_yolox_v0.1.1.exe' (Win32): Loaded 'C:\Windows\System32\bcryptprimitives.dll'. 'lite_yolox_v0.1.1.exe' (Win32): Loaded 'C:\Windows\System32\shell32.dll'. 'lite_yolox_v0.1.1.exe' (Win32): Loaded 'C:\Windows\System32\cfgmgr32.dll'. 'lite_yolox_v0.1.1.exe' (Win32): Loaded 'C:\Windows\System32\SHCore.dll'. 'lite_yolox_v0.1.1.exe' (Win32): Loaded 'C:\Windows\System32\windows.storage.dll'. 'lite_yolox_v0.1.1.exe' (Win32): Loaded 'C:\Windows\System32\profapi.dll'. 'lite_yolox_v0.1.1.exe' (Win32): Loaded 'C:\Windows\System32\powrprof.dll'. 'lite_yolox_v0.1.1.exe' (Win32): Loaded 'C:\Windows\System32\shlwapi.dll'. 'lite_yolox_v0.1.1.exe' (Win32): Loaded 'C:\Windows\System32\kernel.appcore.dll'. 'lite_yolox_v0.1.1.exe' (Win32): Loaded 'C:\Windows\System32\cryptsp.dll'. 'lite_yolox_v0.1.1.exe' (Win32): Loaded 'C:\Windows\System32\userenv.dll'. 'lite_yolox_v0.1.1.exe' (Win32): Loaded 'C:\Windows\System32\lite.ai.toolkit.dll'. Symbols loaded. 'lite_yolox_v0.1.1.exe' (Win32): Loaded 'C:\Windows\System32\opencv_imgcodecs453d.dll'. 'lite_yolox_v0.1.1.exe' (Win32): Loaded 'C:\Windows\System32\opencv_core453d.dll'. 'lite_yolox_v0.1.1.exe' (Win32): Loaded 'C:\Windows\System32\onnxruntime.dll'. 'lite_yolox_v0.1.1.exe' (Win32): Loaded 'C:\Windows\System32\msvcp140d.dll'. 'lite_yolox_v0.1.1.exe' (Win32): Loaded 'C:\Windows\System32\vcruntime140d.dll'. 'lite_yolox_v0.1.1.exe' (Win32): Loaded 'C:\Windows\System32\vcruntime140_1d.dll'. 'lite_yolox_v0.1.1.exe' (Win32): Loaded 'C:\Windows\System32\ucrtbased.dll'. 'lite_yolox_v0.1.1.exe' (Win32): Loaded 'C:\Windows\System32\opencv_videoio453d.dll'. 'lite_yolox_v0.1.1.exe' (Win32): Loaded 'C:\Windows\System32\oleaut32.dll'. 'lite_yolox_v0.1.1.exe' (Win32): Loaded 'C:\Windows\System32\opencv_imgproc453d.dll'. 'lite_yolox_v0.1.1.exe' (Win32): Loaded 'C:\Windows\System32\concrt140d.dll'. 'lite_yolox_v0.1.1.exe' (Win32): Loaded 'C:\Windows\System32\msvcp140.dll'. 'lite_yolox_v0.1.1.exe' (Win32): Loaded 'C:\Windows\System32\vcruntime140_1.dll'. 'lite_yolox_v0.1.1.exe' (Win32): Loaded 'C:\Windows\System32\vcruntime140.dll'. 'lite_yolox_v0.1.1.exe' (Win32): Loaded 'C:\Windows\System32\imm32.dll'. The thread 0x63c has exited with code 0 (0x0). Exception thrown at 0x00007FFD51279129 in lite_yolox_v0.1.1.exe: Microsoft C++ exception: Ort::Exception at memory location 0x0000000FE92FF3D0. Unhandled exception at 0x00007FFD51279129 in lite_yolox_v0.1.1.exe: Microsoft C++ exception: Ort::Exception at memory location 0x0000000FE92FF3D0.

Unhandled exception at 0x00007FFD51279129 in lite_yolox_v0.1.1.exe: Microsoft C++ exception: Ort::Exception at memory location 0x0000000E98CFF5A0.

出错位置: // 1. session ort_session = new Ort::Session(ort_env, onnx_path, session_options);

inline void ThrowOnError(const OrtApi& ort, OrtStatus* status) { if (status) { std::string error_message = ort.GetErrorMessage(status); OrtErrorCode error_code = ort.GetErrorCode(status); ort.ReleaseStatus(status); ORT_CXX_API_THROW(std::move(error_message), error_code); 出错在这行 } }

wwwsctvcom commented 2 years ago

// 1. session ort_session = new Ort::Session(ort_env, onnx_path, session_options);

DefTruth commented 2 years ago

windows下的使用可以参考以下这几个讨论:

另外,我看到你这用的是win32和system32,目前lite.ai.toolkit没有考虑32位的系统。还有就是在windows下编译完之后,需要手动把依赖库都拷贝到build/lite.ai.toolkit/lib和build/lite.ai.toolkit/bin,并且检查修改下模型文件的路径,比如说路径的反斜杠之类的。

ysc3839 commented 2 years ago

@DefTruth Win32 和 System32 不代表系统是 32 位的,从指针长度能明显看出是 64 位的。

DefTruth commented 2 years ago

@ysc3839 给windows大佬点赞

SHX9610 commented 2 years ago

@wwwsctvcom 请问您是如何解决的?我在win下也遇到了这个问题

CSGO01 commented 1 year ago

@wwwsctvcom 请问您是如何解决的?我在win下也遇到了这个问题

你解决了吗

CSGO01 commented 1 year ago

// 1. session ort_session = new Ort::Session(ort_env, onnx_path, session_options);

你解决了吗

CSGO01 commented 1 year ago

windows下的使用可以参考以下这几个讨论:

另外,我看到你这用的是win32和system32,目前lite.ai.toolkit没有考虑32位的系统。还有就是在windows下编译完之后,需要手动把依赖库都拷贝到build/lite.ai.toolkit/lib和build/lite.ai.toolkit/bin,并且检查修改下模型文件的路径,比如说路径的反斜杠之类的。

请问这个有解决办法吗,我也遇到了这个问题 inline void ThrowOnError(const OrtApi& ort, OrtStatus* status) { if (status) { std::string error_message = ort.GetErrorMessage(status); OrtErrorCode error_code = ort.GetErrorCode(status); ort.ReleaseStatus(status); ORT_CXX_API_THROW(std::move(error_message), error_code); } }

CSGO01 commented 1 year ago

// 1. session ort_session = new Ort::Session(ort_env, onnx_path, session_options);

请问解决了吗

CSGO01 commented 1 year ago

@DefTruthWin32 和 System32 不代表系统是 32 位的,从指针长度能明显看出是 64 位的。

我也遇到了 inline void ThrowOnError(const OrtApi& ort, OrtStatus* status) { if (status) { std::string error_message = ort.GetErrorMessage(status); OrtErrorCode error_code = ort.GetErrorCode(status); ort.ReleaseStatus(status); ORT_CXX_API_THROW(std::move(error_message), error_code); } } 请问这个怎么解决呢,也是yolox,网络上就这一个相关信息

Jouiry commented 1 year ago

请问是怎么解决的呀,网上查不到资料~

RayShark commented 10 months ago

@wwwsctvcom @ysc3839 @Jouiry @SHX9610 ,请问一下有大佬解决了这个问题吗?我也遇到了这个问题,好像想编译x86下的项目就会有这个异常。

CSGO01 commented 10 months ago

@wwwsctvcom @ysc3839 @Jouiry @SHX9610,请问一下有大佬解决了这个问题吗?我也遇到了这个问题,希望编译x86下的项目会有这个异常。

目前还是没有成功,我出这个问题是我想更新ort的版本,这个项目最高只有1.10的版本,在高就出错,后面我就换了新的写法,智能指针也没用,项目要改

RayShark commented 10 months ago

@wwwsctvcom @ysc3839 @Jouiry @SHX9610,请问一下有大佬解决了这个问题吗?我也遇到了这个问题,希望编译x86下的项目会有这个异常。

目前还是没有成功,我出这个问题是我想更新ort的版本,这个项目最高只有1.10的版本,在高就出错,后面我就换了新的写法,智能指针也没用,项目要改

我的问题是这样的:我以为model.onnx模型应该是和输出的exe文件在一个目录下的,所以把这个模型文件放到了Release目录下,然后就会报上面那个错误。我把model.onnx放到和main.cpp一样的根目录下就没有这个问题了,可以正常运行。或者改成其他对应的相对路径和绝对路径都是好的。 所以我想我的问题主要还是在模型路径上,可能跟你们的还不太一样。