Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions modules/gapi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ set(gapi_srcs
src/streaming/onevpl/engine/preproc/preproc_engine.cpp
src/streaming/onevpl/engine/preproc/preproc_session.cpp
src/streaming/onevpl/engine/preproc/preproc_dispatcher.cpp
src/streaming/onevpl/engine/preproc_engine_interface.cpp
src/streaming/onevpl/demux/async_mfp_demux_data_provider.cpp
src/streaming/onevpl/data_provider_dispatcher.cpp

Expand Down
26 changes: 24 additions & 2 deletions modules/gapi/include/opencv2/gapi/infer/ie.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ namespace cv {
namespace gapi {
// FIXME: introduce a new sub-namespace for NN?

namespace wip {
namespace onevpl {
struct IDeviceSelector;
}
}
/**
* @brief This namespace contains G-API OpenVINO backend functions,
* structures, and symbols.
Expand Down Expand Up @@ -84,6 +89,9 @@ struct ParamDesc {
// have 2D (Layout::NC) input and if the first dimension not equal to 1
// net.setBatchSize(1) will overwrite it.
cv::optional<size_t> batch_size;

std::shared_ptr<wip::onevpl::IDeviceSelector> pp_device_selector;
std::shared_ptr<wip::onevpl::IDeviceSelector> inference_device_selector;
};
} // namespace detail

Expand Down Expand Up @@ -126,6 +134,8 @@ template<typename Net> class Params {
, {}
, 1u
, {}
, {}
, {}
, {}} {
};

Expand All @@ -148,6 +158,8 @@ template<typename Net> class Params {
, {}
, 1u
, {}
, {}
, {}
, {}} {
};

Expand Down Expand Up @@ -336,6 +348,16 @@ template<typename Net> class Params {
return *this;
}

Params<Net>& cfgPreprocessingDeviceContext(std::shared_ptr<wip::onevpl::IDeviceSelector> selector) {
desc.pp_device_selector = selector;
return *this;
}

Params<Net>& cfgInferenceDeviceContext(std::shared_ptr<wip::onevpl::IDeviceSelector> selector) {
desc.inference_device_selector = selector;
return *this;
}

// BEGIN(G-API's network parametrization API)
GBackend backend() const { return cv::gapi::ie::backend(); }
std::string tag() const { return Net::tag(); }
Expand Down Expand Up @@ -370,7 +392,7 @@ class Params<cv::gapi::Generic> {
const std::string &device)
: desc{ model, weights, device, {}, {}, {}, 0u, 0u,
detail::ParamDesc::Kind::Load, true, {}, {}, {}, 1u,
{}, {}},
{}, {}, {}, {}},
m_tag(tag) {
};

Expand All @@ -388,7 +410,7 @@ class Params<cv::gapi::Generic> {
const std::string &device)
: desc{ model, {}, device, {}, {}, {}, 0u, 0u,
detail::ParamDesc::Kind::Import, true, {}, {}, {}, 1u,
{}, {}},
{}, {}, {}, {}},
m_tag(tag) {
};

Expand Down
10 changes: 10 additions & 0 deletions modules/gapi/include/opencv2/gapi/streaming/onevpl/source.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,16 @@ GAPI_EXPORTS_W cv::Ptr<IStreamSource> inline make_onevpl_src(Args&&... args)
return make_src<onevpl::GSource>(std::forward<Args>(args)...);
}



GAPI_EXPORTS_W std::shared_ptr<onevpl::IDeviceSelector> create_device_selector_default(
const onevpl::CfgParams& params = {});

GAPI_EXPORTS_W std::shared_ptr<onevpl::IDeviceSelector> create_device_selector_ext(
onevpl::Device::Ptr device_ptr,
const std::string& device_id,
onevpl::Context::Ptr ctx_ptr,
const onevpl::CfgParams& params);
} // namespace wip
} // namespace gapi
} // namespace cv
Expand Down
Loading