Skip to content

[G-API]: Introduce RMat serialization API#18584

Merged
alalek merged 7 commits intoopencv:masterfrom
smirnov-alexey:as/rmat_s11n
Oct 20, 2020
Merged

[G-API]: Introduce RMat serialization API#18584
alalek merged 7 commits intoopencv:masterfrom
smirnov-alexey:as/rmat_s11n

Conversation

@smirnov-alexey
Copy link
Copy Markdown
Contributor

@smirnov-alexey smirnov-alexey commented Oct 13, 2020

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-2020.3.0:16.04
build_image:Custom Win=openvino-2020.3.0
build_image:Custom Mac=openvino-2020.3.0

test_modules:Custom=gapi
test_modules:Custom Win=gapi
test_modules:Custom Mac=gapi

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

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.

Looks good generally!


template<typename... Ts>
IOStream& operator<< (IOStream& os, const cv::util::variant<Ts...> &v) {
os << (uint32_t)v.index();
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.

Hmm I believe it should be just os<< v.index(), isn't it?

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.

It returns size_t. We don't support operator<< for that type so the cast here is required

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.

Got it, but I'd use a static_cast instead

} // namespace cv

namespace {
class MyRMatAdapter : public cv::RMat::Adapter {
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.

No alignment between class (in OpenCV, namespaces don't increase the indent level)

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.

Fixed

if (i == gi) {
X x{};
is >> x;
v = std::move(x);
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.

On windows build this code for some reason marked as unreachable which is not true I believe

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.

https://pullrequest.opencv.org/buildbot/builders/precommit_windows64/builds/26706 @alalek can you take a look, please? Can we suppress this or fix somehow? This code is surely reachable (not in .so but in tests)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

As it is a public header, so disabling of this warning in CMake scripts doesn't help with User applications (these CMake scripts are internal and not available for Users).

Try pragma push/disable/pop approach.

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.

Pushed an alternative solution

@dmatveev dmatveev self-assigned this Oct 15, 2020
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.

Great, thanks!

@alalek
Copy link
Copy Markdown
Member

alalek commented Oct 15, 2020

Build warnings must be fixed before merge.

}
};

template<typename T> struct deserialize_runarg;
Copy link
Copy Markdown
Contributor

@AsyaPronina AsyaPronina Oct 15, 2020

Choose a reason for hiding this comment

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

what is about to name structure above : deserialize_carg and this one deserialize_rarg?

It is only a suggestion, no actions required if you don't think that it is reasonable to do now

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.

carg and rarg are harder to understand

@dmatveev
Copy link
Copy Markdown
Contributor

Build warnings must be fixed before merge.

@alalek we have a little idea how to fix this particular warning, do you have any suggestions?

# Disable obsollete warning C4503 popping up on MSVC <<2017
# https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4503?view=vs-2019
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4503)
# FXIME: enable 4702 warning (unreachable code) when the issue is fixed
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

typo

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.

Fixed, thanks

@dmatveev
Copy link
Copy Markdown
Contributor

@alalek required builds have passed. Can you please merge this? Our internal integration this WW depends on this feature.

Thanks!
D

@dmatveev
Copy link
Copy Markdown
Contributor

@alalek @mshabunin is there anything else to do for merge?

@dmatveev
Copy link
Copy Markdown
Contributor

...

@alalek
Copy link
Copy Markdown
Member

alalek commented Oct 20, 2020

@dmatveev See https://github.com/opencv/opencv/pull/18584/files#r508380384
If G-API team doesn't care please react properly and let us know.

@dmatveev
Copy link
Copy Markdown
Contributor

See https://github.com/opencv/opencv/pull/18584/files#r508380384

Just noticed this, thanks. Alexey is on vacation currently. Let's see what's with push/pop

@alalek alalek merged commit 2669d8c into opencv:master Oct 20, 2020
@dmatveev
Copy link
Copy Markdown
Contributor

@alalek thanks!

@alalek alalek mentioned this pull request Nov 27, 2020
a-sajjad72 pushed a commit to a-sajjad72/opencv that referenced this pull request Mar 30, 2023
[G-API]: Introduce RMat serialization API

* Introduce RMat serialization API

* Fix RunArgs deserialization

* Address review comments

* Export operators for GRunArg serialization

* Fix warning and add handling for RMat in bind()

* Update CMakeLists.txt

* G-API: RMat S11N -- probably fix the Windows warning
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.

4 participants