Merge pull request #18943 from mpashchenkov:mp/onnx-padding

G-API: ONNX. Support for networks with three dimensional input.

* Padding without tests

* Removed padding

* Some small fixes

* Added wstring_convert

* Alignment fix, m b

* Small fixes

* Moved include from onnx.hpp
This commit is contained in:
Maxim Pashchenkov
2021-01-29 17:53:42 +03:00
committed by GitHub
parent 4c7f56263e
commit e250bae356
3 changed files with 31 additions and 10 deletions
@@ -11,6 +11,7 @@
#include <stdexcept>
#include <onnxruntime_cxx_api.h>
#include <ade/util/iota_range.hpp>
#include <codecvt> // wstring_convert
#include <opencv2/gapi/own/convert.hpp>
#include <opencv2/gapi/infer/onnx.hpp>
@@ -257,7 +258,13 @@ public:
template<typename T>
void infer(const std::vector<cv::Mat>& ins, std::vector<cv::Mat>& outs) {
// Prepare session
#ifndef _WIN32
session = Ort::Session(env, model_path.data(), session_options);
#else
std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t> converter;
std::wstring w_model_path = converter.from_bytes(model_path.data());
session = Ort::Session(env, w_model_path.data(), session_options);
#endif
num_in = session.GetInputCount();
num_out = session.GetOutputCount();
GAPI_Assert(num_in == ins.size());
@@ -910,7 +917,6 @@ TEST_F(ONNXYoloV3MultiInput, InferBSConstInput)
// Validate
validate();
}
} // namespace opencv_test
#endif // HAVE_ONNX