mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 15:23:05 +04:00
Merge pull request #23796 from TolyaTalamanov:at/align-ie-backend-with-latest-openvino
G-API: Align IE Backend with the latest OpenVINO version #23796 ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [ ] I agree to contribute to the project under Apache 2 License. - [ ] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [ ] The PR is proposed to the proper branch - [ ] There is a reference to the original bug report and related work - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
committed by
GitHub
parent
004801f1c5
commit
0cf45b89ec
@@ -949,7 +949,11 @@ inline IE::Blob::Ptr extractBlob(IECallContext& ctx,
|
||||
auto y_blob = ctx.uu.rctx->CreateBlob(blob_params->first.first, blob_params->first.second);
|
||||
auto uv_blob = ctx.uu.rctx->CreateBlob(blob_params->second.first, blob_params->second.second);
|
||||
|
||||
#if INF_ENGINE_RELEASE >= 2021010000
|
||||
#if INF_ENGINE_RELEASE > 2023000000
|
||||
cv::util::throw_error(std::logic_error(
|
||||
"IE Backend: NV12 feature has been deprecated in OpenVINO 1.0 API."
|
||||
" The last version which supports this is 2023.0"));
|
||||
#elif INF_ENGINE_RELEASE >= 2021010000
|
||||
return IE::make_shared_blob<IE::NV12Blob>(y_blob, uv_blob);
|
||||
#else
|
||||
return IE::make_shared_blob<InferenceEngine::NV12Blob>(y_blob, uv_blob);
|
||||
@@ -982,7 +986,14 @@ static void setBlob(InferenceEngine::InferRequest& req,
|
||||
req.SetBlob(layer_name, blob);
|
||||
} else {
|
||||
GAPI_Assert(ctx.uu.params.kind == ParamDesc::Kind::Import);
|
||||
#if INF_ENGINE_RELEASE > 2023000000
|
||||
// NB: SetBlob overload which accepts IE::PreProcessInfo
|
||||
// has been deprecated - preprocessing can't be configured
|
||||
// for "Import" networks anymore.
|
||||
req.SetBlob(layer_name, blob);
|
||||
#else
|
||||
req.SetBlob(layer_name, blob, ctx.uu.preproc_map.at(layer_name));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1370,7 +1381,14 @@ static void cfgImagePreprocessing(const IE::InputInfo::Ptr &ii,
|
||||
if (cv::util::holds_alternative<cv::GFrameDesc>(mm)) {
|
||||
const auto &meta = util::get<cv::GFrameDesc>(mm);
|
||||
if (meta.fmt == cv::MediaFormat::NV12) {
|
||||
#if INF_ENGINE_RELEASE > 2023000000
|
||||
cv::util::throw_error(std::logic_error(
|
||||
"IE Backend: cv::MediaFrame with NV12 format is no longer supported"
|
||||
" because NV12 feature has been deprecated in OpenVINO 1.0 API."
|
||||
" The last version which supports this is 2023.0"));
|
||||
#else
|
||||
ii->getPreProcess().setColorFormat(IE::ColorFormat::NV12);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1426,7 +1444,14 @@ static IE::PreProcessInfo createImagePreProcInfo(const cv::GMetaArg &mm,
|
||||
if (cv::util::holds_alternative<cv::GFrameDesc>(mm)) {
|
||||
const auto &meta = util::get<cv::GFrameDesc>(mm);
|
||||
if (meta.fmt == cv::MediaFormat::NV12) {
|
||||
#if INF_ENGINE_RELEASE > 2023000000
|
||||
cv::util::throw_error(std::logic_error(
|
||||
"IE Backend: cv::MediaFrame with NV12 format is no longer supported"
|
||||
" because NV12 feature has been deprecated in OpenVINO 1.0 API."
|
||||
" The last version which supports this is 2023.0"));
|
||||
#else
|
||||
info.setColorFormat(IE::ColorFormat::NV12);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
return info;
|
||||
@@ -2299,7 +2324,11 @@ IE::Blob::Ptr cv::gapi::ie::util::to_ie(const cv::Mat &blob) {
|
||||
IE::Blob::Ptr cv::gapi::ie::util::to_ie(const cv::Mat &y_plane, const cv::Mat &uv_plane) {
|
||||
auto y_blob = wrapIE(y_plane, cv::gapi::ie::TraitAs::IMAGE);
|
||||
auto uv_blob = wrapIE(uv_plane, cv::gapi::ie::TraitAs::IMAGE);
|
||||
#if INF_ENGINE_RELEASE >= 2021010000
|
||||
#if INF_ENGINE_RELEASE > 2023000000
|
||||
cv::util::throw_error(std::logic_error(
|
||||
"IE Backend: NV12 feature has been deprecated in OpenVINO 1.0 API."
|
||||
" The last version which supports this is 2023.0"));
|
||||
#elif INF_ENGINE_RELEASE >= 2021010000
|
||||
return IE::make_shared_blob<IE::NV12Blob>(y_blob, uv_blob);
|
||||
#else
|
||||
return IE::make_shared_blob<InferenceEngine::NV12Blob>(y_blob, uv_blob);
|
||||
|
||||
Reference in New Issue
Block a user