gapi: fix build, update IE handling, add OPENCV_GAPI_INF_ENGINE

This commit is contained in:
Alexander Alekhin
2020-04-22 21:41:36 +00:00
parent 94e36d8c8d
commit 351fb8c058
3 changed files with 25 additions and 7 deletions
+6 -3
View File
@@ -35,6 +35,7 @@
#include <opencv2/gapi/util/any.hpp>
#include <opencv2/gapi/gtype_traits.hpp>
#include <opencv2/gapi/infer.hpp>
#include <opencv2/gapi/own/convert.hpp>
#include "compiler/gobjref.hpp"
#include "compiler/gmodel.hpp"
@@ -211,6 +212,7 @@ struct IEUnit {
cv::gimpl::ie::IECompiled compile() const {
auto this_plugin = IE::PluginDispatcher().getPluginByDevice(params.device_id);
#if INF_ENGINE_RELEASE < 2020000000 // <= 2019.R3
// Load extensions (taken from DNN module)
if (params.device_id == "CPU" || params.device_id == "FPGA")
{
@@ -247,10 +249,11 @@ struct IEUnit {
}
catch(...)
{
CV_LOG_WARNING(NULL, "Failed to load IE extension " << extlib);
CV_LOG_INFO(NULL, "Failed to load IE extension: " << extlib);
}
}
}
#endif
auto this_network = this_plugin.LoadNetwork(net, {}); // FIXME: 2nd parameter to be
// configurable via the API
@@ -514,7 +517,7 @@ struct Infer: public cv::detail::KernelTag {
// and redirect our data producers to this memory
// (A memory dialog comes to the picture again)
const cv::Mat this_mat = to_ocv(ctx.inMat(i));
const cv::Mat this_mat = ctx.inMat(i);
// FIXME: By default here we trait our inputs as images.
// May be we need to make some more intelligence here about it
IE::Blob::Ptr this_blob = wrapIE(this_mat, cv::gapi::ie::TraitAs::IMAGE);
@@ -586,7 +589,7 @@ struct InferList: public cv::detail::KernelTag {
GAPI_Assert(uu.params.num_in == 1); // roi list is not counted in net's inputs
const auto& in_roi_vec = ctx.inArg<cv::detail::VectorRef>(0u).rref<cv::Rect>();
const cv::Mat this_mat = to_ocv(ctx.inMat(1u));
const cv::Mat this_mat = ctx.inMat(1u);
// Since we do a ROI list inference, always assume our input buffer is image
IE::Blob::Ptr this_blob = wrapIE(this_mat, cv::gapi::ie::TraitAs::IMAGE);