Skip to content

G-API: add documentation on serialization functionality#20163

Merged
alalek merged 18 commits intoopencv:masterfrom
smirnov-alexey:as/gapi_serialization_docs
Jul 7, 2021
Merged

G-API: add documentation on serialization functionality#20163
alalek merged 18 commits intoopencv:masterfrom
smirnov-alexey:as/gapi_serialization_docs

Conversation

@smirnov-alexey
Copy link
Copy Markdown
Contributor

@smirnov-alexey smirnov-alexey commented May 26, 2021

Docs: http://pullrequest.opencv.org/buildbot/export/pr/20163/docs/

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

@dmatveev @TolyaTalamanov @mpashchenkov please, review. Not sure if I need to add more examples (for instance, on S11N overload). Actually, I didn't document everything in s11n.hpp since it's not for user to utilize. However, bind() is also not quite for end users (rather for our backends development). What do you think?

* @return deserialized GComputation object.
*/
template<> inline
cv::GComputation deserialize(const std::vector<char> &p) {
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.

@alalek could you help a little? Do you know how to correctly document template specialization (or whatever the issue causes docs corruption)? Currently it looks like this: https://pullrequest.opencv.org/buildbot/export/pr/20163/docs/db/d06/group__gapi__serialization.html

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.

I believe it looks ok in your example - isn't it?

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.

(I see only two derializes there though)

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.

Let's ignore this for now. I will create a separate task to fix it later

@dmatveev dmatveev self-assigned this Jun 7, 2021
@dmatveev dmatveev added this to the 4.5.3 milestone Jun 7, 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.

Good start

@smirnov-alexey
Copy link
Copy Markdown
Contributor Author

@TolyaTalamanov @mpashchenkov please, take a look once the doc build is ready

Copy link
Copy Markdown
Contributor

@mpashchenkov mpashchenkov left a comment

Choose a reason for hiding this comment

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

Overall looks good.


int main(int argc, char *argv[])
{
(void) argc;
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.

Why don't use int main() instead ?

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

@TolyaTalamanov TolyaTalamanov self-requested a review June 23, 2021 11:07
@smirnov-alexey smirnov-alexey force-pushed the as/gapi_serialization_docs branch from 148f47d to 78282bb Compare June 23, 2021 12:23
@smirnov-alexey
Copy link
Copy Markdown
Contributor Author

@alalek can we merge this?

#include <opencv2/gapi/garg.hpp>

int main()
{
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.

modules/gapi/samples

It makes sense to put these documentation-only non-functional samples somewhere else.

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.

@alalek I believe gapi/samples is the only place for such things - it provides examples for docs (via @snippet) and also checks that the code compiles

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.

OpenCV 'core' snippets are stored into <opencv>/samples/cpp/tutorial_code/core/...

Users expecting in gapi/samples full-functional samples which can be run and show some meanungful result.


examples for docs

Check generated Doxyfile - there are many paths for storing that.


@snippet custom_type_serialization.cpp

This filename is not enough to be unique across whole project (other cases have similar problem).
Use path with gapi entry (append path prefix) to avoid ambiguous problem in the future.

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.

@alalek I fixed the prefixes where applicable. Speaking of an appropriate place for these snippets: I've found 2 incomplete samples in g-api: dynamic_graph.cpp and kernel_api_snippets.cpp. I've copied std::cout << "This sample is non-complete. It is used as code snippents in documentation." << std::endl; to my samples. Is that enough? If you think that's still an issue can it be fixed separately?

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.

Also, can we merge this without a second Dmitry's review?

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.

It makes sense to put these documentation-only non-functional samples somewhere else.

@alalek , Our documentation-related code (so it is "snippets) was there from the early beginning but if there's a better place, we can move it there for sure for all the snippets.

#include <opencv2/gapi/garg.hpp>

int main()
{
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.

OpenCV 'core' snippets are stored into <opencv>/samples/cpp/tutorial_code/core/...

Users expecting in gapi/samples full-functional samples which can be run and show some meanungful result.


examples for docs

Check generated Doxyfile - there are many paths for storing that.


@snippet custom_type_serialization.cpp

This filename is not enough to be unique across whole project (other cases have similar problem).
Use path with gapi entry (append path prefix) to avoid ambiguous problem in the future.

@smirnov-alexey
Copy link
Copy Markdown
Contributor Author

@dmatveev please, take a look once again

* @param bytes vector of bytes to deserialize GCompileArgs object from.
* @return GCompileArgs object.
* @see GCompileArgs S11N
* @see GCompileArgs cv::gapi::s11n::detail::S11N
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 it is strange to see detail:: thing in the documentation -- is our overloadable S11N structure still there?

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.

Yes, it's still there

@smirnov-alexey
Copy link
Copy Markdown
Contributor Author

@alalek can we merge this, please?

@alalek alalek merged commit 59ae0e0 into opencv:master Jul 7, 2021
@alalek alalek mentioned this pull request Oct 15, 2021
a-sajjad72 pushed a commit to a-sajjad72/opencv that referenced this pull request Mar 30, 2023
…tion_docs

G-API: add documentation on serialization functionality

* Add documentation on serialization/deserialization

* Add docs on bind() methods

* Fix typo

* Docs refactoring

* Fix s11n docs

* Fix deserialize() docs

* Change deserialize docs

* Fix warning

* Address review comments

* Fix sample

* Fix warnings and errors

* Fix docs warnings

* Fix warnings

* Address review comments

* Add prefixes to snippets and fix indentation

* Address review comments and move snippets to a single file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants