From b8b8c7c9e5debd60941376d27c4b0ad90cc1fc7b Mon Sep 17 00:00:00 2001 From: Anatoliy Talamanov Date: Wed, 28 Jun 2023 12:52:15 +0100 Subject: [PATCH] Merge pull request #23884 from TolyaTalamanov:at/fix-async-infer-ov-backend G-API: Fix async inference for OpenVINO backend #23884 ### 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 --- modules/gapi/src/backends/ov/govbackend.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/gapi/src/backends/ov/govbackend.cpp b/modules/gapi/src/backends/ov/govbackend.cpp index 8b6ded45f1..8384a9d188 100644 --- a/modules/gapi/src/backends/ov/govbackend.cpp +++ b/modules/gapi/src/backends/ov/govbackend.cpp @@ -1403,8 +1403,10 @@ cv::gimpl::ov::GOVExecutable::GOVExecutable(const ade::Graph &g, case NodeType::OP: if (this_nh == nullptr) { this_nh = nh; - compiled = const_cast(ovm.metadata(this_nh).get()).compile(); - m_reqPool.reset(new RequestPool(createInferRequests(compiled.compiled_model, 1))); + const auto &unit = ovm.metadata(this_nh).get(); + compiled = const_cast(unit).compile(); + m_reqPool.reset(new RequestPool(createInferRequests( + compiled.compiled_model, unit.params.nireq))); } else util::throw_error(std::logic_error("Multi-node inference is not supported!")); @@ -1436,6 +1438,7 @@ void cv::gimpl::ov::GOVExecutable::run(cv::gimpl::GIslandExecutable::IInput &in if (cv::util::holds_alternative(in_msg)) { + m_reqPool->waitAll(); out.post(cv::gimpl::EndOfStream{}); return; } -- GitLab