Skip to content

G-API: Support remote inference#20156

Merged
alalek merged 15 commits intoopencv:masterfrom
smirnov-alexey:as/gapi_remote_infer
Jun 25, 2021
Merged

G-API: Support remote inference#20156
alalek merged 15 commits intoopencv:masterfrom
smirnov-alexey:as/gapi_remote_infer

Conversation

@smirnov-alexey
Copy link
Copy Markdown
Contributor

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 other license that is incompatible with OpenCV
  • The PR is proposed to proper branch
  • There is reference to 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
force_builders=Custom,Custom Win,Custom Mac
build_gapi_standalone:Linux x64=ade-0.1.1f
build_gapi_standalone:Win64=ade-0.1.1f
build_gapi_standalone:Mac=ade-0.1.1f
build_gapi_standalone:Linux x64 Debug=ade-0.1.1f

Xbuild_image:Custom=centos:7
Xbuildworker:Custom=linux-1
build_gapi_standalone:Custom=ade-0.1.1f

build_image:Custom=ubuntu-openvino-2021.3.0:20.04
build_image:Custom Win=openvino-2021.3.0
build_image:Custom Mac=openvino-2021.3.0

test_modules:Custom=gapi,python2,python3,java
test_modules:Custom Win=gapi,python2,python3,java
test_modules:Custom Mac=gapi,python2,python3,java

buildworker:Custom=linux-1
# disabled due high memory usage: test_opencl:Custom=ON
test_opencl:Custom=OFF
test_bigdata:Custom=1
test_filter:Custom=*

@smirnov-alexey
Copy link
Copy Markdown
Contributor Author

This PR: #20151 has to be merged first

@smirnov-alexey
Copy link
Copy Markdown
Contributor Author

@dmatveev @TolyaTalamanov @rgarnov @AsyaPronina please, review

@dmatveev dmatveev self-assigned this May 31, 2021
@dmatveev dmatveev added this to the 4.5.3 milestone May 31, 2021
Copy link
Copy Markdown
Contributor

@dmatveev dmatveev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rest of the diff seems to be mediaframe extension-related

@smirnov-alexey
Copy link
Copy Markdown
Contributor Author

@dmatveev please, take a look at the changes

Copy link
Copy Markdown
Contributor

@dmatveev dmatveev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TolyaTalamanov I expect your review on the blob management part in the iebackend.

@dmatveev dmatveev requested a review from TolyaTalamanov June 3, 2021 08:07
@smirnov-alexey
Copy link
Copy Markdown
Contributor Author

@dmatveev please, take a look once more

@smirnov-alexey
Copy link
Copy Markdown
Contributor Author

@dmatveev please, take a look at the latest version

@dmatveev
Copy link
Copy Markdown
Contributor

@TolyaTalamanov any review from your end here?

explicit IEUnit(const cv::gapi::ie::detail::ParamDesc &pp)
: params(pp) {
InferenceEngine::ParamMap* ctx_params =
cv::util::any_cast<InferenceEngine::ParamMap>(&params.context_config);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so before making this cast at all, can you please check if any is not null?

Copy link
Copy Markdown
Contributor Author

@smirnov-alexey smirnov-alexey Jun 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we can check if it's null besides casting it to something

Copy link
Copy Markdown
Contributor

@dmatveev dmatveev Jun 25, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Under null I mean empty, but I see our any don't have has_value as defined in std

Please add a follow-up task

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a task

if (ctx_params != nullptr) {
auto ie_core = cv::gimpl::ie::wrap::getCore();
rctx = ie_core.CreateContext(params.device_id, *ctx_params);
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and if it is not null and couldn't cast, we should probably print out a warning.

Copy link
Copy Markdown
Contributor Author

@smirnov-alexey smirnov-alexey Jun 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we can check if it's null besides casting it to something

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above

@smirnov-alexey
Copy link
Copy Markdown
Contributor Author

@dmatveev @TolyaTalamanov please, take a look and lets merge this as a first approximation

Copy link
Copy Markdown
Contributor

@dmatveev dmatveev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's merge it, thanks.

/** @brief Specifies configuration for RemoteContext in InferenceEngine.

When RemoteContext is configured the backend imports the networks using the context.
It also expects cv::MediaFrames to be actually remote, to operate with blobs via the context.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cv::MediaFrames -> input data.

@alalek alalek merged commit c95a564 into opencv:master Jun 25, 2021
@alalek alalek mentioned this pull request Oct 15, 2021
TolyaTalamanov pushed a commit that referenced this pull request Dec 8, 2021
G-API: Support remote inference

* Extend MediaFrame to be able to extract additional info besides access

* Add API for remote inference

* Add default implementation for blobParams()

* Add default implementation for blobParams()

* Address review comments

* Fix any_cast usage

* Add comment on the default blobParams()

* Address review comments

* Add missing rctx

* Minor fix

* Fix indentation and comment

* Address review comments

* Add documentation
a-sajjad72 pushed a commit to a-sajjad72/opencv that referenced this pull request Mar 30, 2023
G-API: Support remote inference

* Extend MediaFrame to be able to extract additional info besides access

* Add API for remote inference

* Add default implementation for blobParams()

* Add default implementation for blobParams()

* Address review comments

* Fix any_cast usage

* Add comment on the default blobParams()

* Address review comments

* Add missing rctx

* Minor fix

* Fix indentation and comment

* Address review comments

* Add documentation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants