【解决---LSTR-error:no matching function‘Ort::Session::Session(Ort::Env&, const wchar_t*, Ort::Sessi】

项目场景:

部署车道线检测算法——LSTR-lane-detect-onnxruntime出现的一个小问题!!

LSTR-lane-detect-onnxrun-cpp-py-main/main.cpp:48:64: error: no matching function for call to ‘Ort::Session::Session(Ort::Env&, const wchar_t*, Ort::SessionOptions&)

问题描述

make出现了问题:

(base) l@l:~/LSTR-lane-detect-onnxrun-cpp-py-main/build$ make
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ls/LSTR-lane-detect-onnxrun-cpp-py-main/build
[ 50%] Building CXX object CMakeFiles/LSTRLane.dir/main.cpp.o
/home/l/LSTR-lane-detect-onnxrun-cpp-py-main/main.cpp: In constructor ‘LSTR::LSTR():
/home/l/LSTR-lane-detect-onnxrun-cpp-py-main/main.cpp:48:64: error: no matching function for call to ‘Ort::Session::Session(Ort::Env&, const wchar_t*, Ort::SessionOptions&)48 |  ort_session = new Session(env, widestr.c_str(), sessionOptions);
      |                                                                ^
In file included from /usr/local/include/onnxruntime/core/session/onnxruntime_cxx_api.h:650,
                 from /home/ls/LSTR-lane-detect-onnxrun-cpp-py-main/main.cpp:8:
/usr/local/include/onnxruntime/core/session/onnxruntime_cxx_inline.h:522:8: note: candidate: ‘Ort::Session::Session(Ort::Env&, const void*, size_t, const Ort::SessionOptions&)’
。。。。。。

onnxruntime的版本问题:

我用的是1.8.0版本的 onnruntime:
Ort::Session::Session(Ort::Env&, const wchar_t*, Ort::SessionOptions&)

需要对代码中的部分函数进行修改~


解决方案:

原始代码:

LSTR::LSTR()
{
	string model_path = "/home/l/LSTR-lane-detect-onnxrun-cpp-py-main/lstr_360x640.onnx";
	std::wstring widestr = std::wstring(model_path.begin(), model_path.end());
	sessionOptions.SetGraphOptimizationLevel(ORT_ENABLE_BASIC);
	ort_session = new Session(env, model_path.c_str(), sessionOptions);
	size_t numInputNodes = ort_session->GetInputCount();
	size_t numOutputNodes = ort_session->GetOutputCount();
	。。。。。

后面进行修改:

LSTR::LSTR()
{
	string model_path = "/home/l/LSTR-lane-detect-onnxrun-cpp-py-main/lstr_360x640.onnx";
	sessionOptions.SetGraphOptimizationLevel(ORT_ENABLE_BASIC);
	ort_session = new Session(env, model_path.c_str(), sessionOptions);
	size_t numInputNodes = ort_session->GetInputCount();
	size_t numOutputNodes = ort_session->GetOutputCount();

欧克欧克,就这样解决了问题了!!!!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值