OnnxRunTime Problem
SwEngine opened this issue · 10 comments
SwEngine commented
When I run the main.cpp in Colab with "!g++ /content/yolov7-detect-face-onnxrun-cpp-py/main.cpp -o cv -I/usr/include/opencv4 -I/usr/local/include/onnxruntime/", I got the errors below. What can be the problem and the solution?
/content/yolov7-detect-face-onnxrun-cpp-py/main.cpp: In constructor ‘YOLOV7_face::YOLOV7_face(Net_config)’:
/content/yolov7-detect-face-onnxrun-cpp-py/main.cpp:76:64: error: no matching function for call to ‘Ort::Session::Session(Ort::Env&, const wchar_t*, Ort::SessionOptions&)’
76 | ort_session = new Session(env, widestr.c_str(), sessionOptions);
| ^
In file included from /usr/local/include/onnxruntime/onnxruntime_cxx_api.h:1876,
from /content/yolov7-detect-face-onnxrun-cpp-py/main.cpp:7:
/usr/local/include/onnxruntime/onnxruntime_cxx_inline.h:950:8: note: candidate: ‘Ort::Session::Session(const Ort::Env&, const void*, size_t, const Ort::SessionOptions&, OrtPrepackedWeightsContainer*)’
950 | inline Session::Session(const Env& env, const void* model_data, size_t model_data_length,
| ^~~~~~~
/usr/local/include/onnxruntime/onnxruntime_cxx_inline.h:950:8: note: candidate expects 5 arguments, 3 provided
/usr/local/include/onnxruntime/onnxruntime_cxx_inline.h:946:8: note: candidate: ‘Ort::Session::Session(const Ort::Env&, const void*, size_t, const Ort::SessionOptions&)’
946 | inline Session::Session(const Env& env, const void* model_data, size_t model_data_length, const SessionOptions& options) {
| ^~~~~~~
/usr/local/include/onnxruntime/onnxruntime_cxx_inline.h:946:8: note: candidate expects 4 arguments, 3 provided
/usr/local/include/onnxruntime/onnxruntime_cxx_inline.h:941:8: note: candidate: ‘Ort::Session::Session(const Ort::Env&, const char*, const Ort::SessionOptions&, OrtPrepackedWeightsContainer*)’
941 | inline Session::Session(const Env& env, const ORTCHAR_T* model_path, const SessionOptions& options,
| ^~~~~~~
/usr/local/include/onnxruntime/onnxruntime_cxx_inline.h:941:8: note: candidate expects 4 arguments, 3 provided
/usr/local/include/onnxruntime/onnxruntime_cxx_inline.h:937:8: note: candidate: ‘Ort::Session::Session(const Ort::Env&, const char*, const Ort::SessionOptions&)’
937 | inline Session::Session(const Env& env, const ORTCHAR_T* model_path, const SessionOptions& options) {
| ^~~~~~~
/usr/local/include/onnxruntime/onnxruntime_cxx_inline.h:937:58: note: no known conversion for argument 2 from ‘const wchar_t*’ to ‘const char*’
937 | inline Session::Session(const Env& env, const ORTCHAR_T* model_path, const SessionOptions& options) {
| ~~~~~~~~~~~~~~~~~^~~~~~~~~~
In file included from /content/yolov7-detect-face-onnxrun-cpp-py/main.cpp:7:
/usr/local/include/onnxruntime/onnxruntime_cxx_api.h:783:12: note: candidate: ‘Ort::Session::Session(std::nullptr_t)’
783 | explicit Session(std::nullptr_t) {} ///< Create an empty Session object, must be assigned a valid one to be used
| ^~~~~~~
/usr/local/include/onnxruntime/onnxruntime_cxx_api.h:783:12: note: candidate expects 1 argument, 3 provided
/usr/local/include/onnxruntime/onnxruntime_cxx_api.h:782:8: note: candidate: ‘Ort::Session::Session(Ort::Session&&)’
782 | struct Session : detail::SessionImpl<OrtSession> {
| ^~~~~~~
/usr/local/include/onnxruntime/onnxruntime_cxx_api.h:782:8: note: candidate expects 1 argument, 3 provided
/content/yolov7-detect-face-onnxrun-cpp-py/main.cpp:82:38: error: ‘struct Ort::Session’ has no member named ‘GetInputName’
82 | input_names.push_back(ort_session->GetInputName(i, allocator));
| ^~~~~~~~~~~~
/content/yolov7-detect-face-onnxrun-cpp-py/main.cpp:90:39: error: ‘struct Ort::Session’ has no member named ‘GetOutputName’
90 | output_names.push_back(ort_session->GetOutputName(i, allocator));
| ^~~~~~~~~~~~~
SwEngine commented
I also tried with CMAKE, but got same errors.