Skip to content

G-API Initial code upload#12608

Merged
alalek merged 7 commits intoopencv:masterfrom
dmatveev:gapi
Sep 26, 2018
Merged

G-API Initial code upload#12608
alalek merged 7 commits intoopencv:masterfrom
dmatveev:gapi

Conversation

@dmatveev
Copy link
Copy Markdown
Contributor

This is the initial source code upload for new OpenCV 4 module "Graph API":

OpenCV Graph API (or G-API) is a new OpenCV module targeted to make
regular image processing fast and portable. These two goals are
achieved by introducing a new graph-based model of execution.

Traditionally OpenCV provided a lot of stand-alone image processing
functions (see modules core and imgproc). Many of that functions
are well-optimized (e.g. vectorized for specific CPUs, parallel, etc)
but still the out-of-box optimization scope has been limited to a
single function only -- optimizing the whole algorithm built atop of that
functions was a responsibility of a programmer.

OpenCV 3.0 introduced Transparent API (or T-API) which allowed to
offload OpenCV function calls transparently to OpenCL devices and save
on Host/Device data transfers with cv::UMat -- and it was a great step
forward. However, T-API is a dynamic API -- user code still remains
unconstrained and OpenCL kernels are enqueued in arbitrary order, thus
eliminating further pipeline-level optimization potential.

G-API brings implicit graph model to OpenCV 4.0. Graph model captures
all operations and its data dependencies in a pipeline and so provides
G-API framework with extra information to do pipeline-level
optimizations.

This is an integration branch -- it will be updated with new changes.
Please don't push to this branch directly.

Documentation and samples are WIP and will be pushed in a week or two.

@mshabunin
Copy link
Copy Markdown
Contributor

@@ -0,0 +1,92 @@
# FIXME: Remove CXX11 check after complete switch to OpenCV 4 branch
# (CI, bundle, workloads, etc)
if (NOT HAVE_CXX11 OR NOT TARGET ade)
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.

Maybe we should disable building this module with older GCC versions due to missing std::aligned_union. Something like this:

if ((CV_GCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9) OR ...)

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.

I think we better rewrite that code and drop aligned_union

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.

Should be fixed now (at least build passes locally with gcc4.8)

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.

ANDROID is excluded from the build so far, but the code builds fine with other gcc4.8 builders (e.g. ARMv7)

* The majority of OpenCV buildbot problems was addressed
@dmatveev
Copy link
Copy Markdown
Contributor Author

Seems the latest problem with build on macOS is similar to gsl-lite/gsl-lite#63


int unused[] = { 0, (pkg.include<KK>(), 0)... };
(void) unused;
cv::util::suppress_unused_warning(unused);
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.

There is CV_UNUSED macro in the core module.

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.

As G-API is being decoupled from OpenCV in parallel, we'll need to have our own

* Linux warnings should be resolved
* Documentation build should become green
* Number of Windows warnings should be reduced
* ARMv7 build issue should be resolved
* ADE is bumped to latest version and should fix Clang builds for macOS/iOS
* Remaining Windows warnings should be resolved
* New Linux32 / ARMv7 warnings should be resolved
@dmatveev
Copy link
Copy Markdown
Contributor Author

The latest status: only 1 warning remaining on Windows, will fix in a couple of hours.

ARMv7 test fails (and I don't have a clue why): http://pullrequest.opencv.org/buildbot/builders/precommit_armv7/builds/11175

* Final Windows warnings should be resolved now
@dmatveev
Copy link
Copy Markdown
Contributor Author

@alalek @mshabunin @vpisarev feel lucky today :)

Copy link
Copy Markdown
Member

@alalek alalek left a comment

Choose a reason for hiding this comment

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

Well done!

GAPI_Assert(fx != 0. && fy != 0.);
return in.withSize
(Size(static_cast<int>(std::round(in.size.width * fx)),
static_cast<int>(std::round(in.size.height * fy))));
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.

std::round?

Perhaps this should not have huge impact if fx/fy is not passed into "implementation" functions after that (only dstSize is used).

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.

Not sure what you mean

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 uses own cvRound() (nearest-to-even) in cv::resize().

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.

ah ok. We do pass tests against cv::resize() already, so let's put this stuff into the backlog so address later (within the release timeframe).



#include <ade/graph.hpp>
#include "test_precomp.hpp"
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.

"precomp.hpp" should be the first unconditional include.

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.

This and all below issues are now resolved



#include "compiler/transactions.hpp"
#include "test_precomp.hpp"
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.

"precomp.hpp" should be the first unconditional include.


#include <ade/util/zip_range.hpp> // util::indexed

#include "test_precomp.hpp"
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.

"precomp.hpp" should be the first unconditional include.


#include <type_traits>

#include "test_precomp.hpp"
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.

"precomp.hpp" should be the first unconditional include.

// Copyright (C) 2018 Intel Corporation


#include "test_precomp.hpp"
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.

Please avoid using of "precomp.hpp" in header files (it should/must be used in .cpp files only).
Introduce some "test_common.hpp" if you really need to include set of common headers.

Similar files:

  • modules/gapi/test/common/gapi_core_tests.hpp
  • modules/gapi/test/common/gapi_imgproc_tests.hpp
  • modules/gapi/test/common/gapi_operators_tests.hpp
  • modules/gapi/test/gapi_fluid_test_kernels.hpp
  • modules/gapi/src/backends/common/gbackend.hpp
  • modules/gapi/perf/common/gapi_imgproc_perf_tests.hpp

@vpisarev
Copy link
Copy Markdown
Contributor

let's merge it!

* Fixed issues with precompiled headers in module and its tests
@alalek alalek merged commit 29e88e5 into opencv:master Sep 26, 2018
AhiyaHiya pushed a commit to AhiyaHiya/opencv that referenced this pull request Sep 27, 2018
* master: (286 commits)
  Merge pull request opencv#12608 from dmatveev:gapi
  M_PI changed to CV_PI (opencv#12645)
  dnn: fix printf format warning
  Merge pull request opencv#12615 from D-Alex:master
  Fixed several incorrect printf format specifiers
  core: fix printf warnings by using c++11 format
  core: enable printf format warnings for cv::format
  JS: Support enum properties
  fix a bug in OpenGL
  samples: update winpack python samples launcher
  Merge pull request opencv#12310 from cv3d:chunks/enum_interface
  Merge pull request opencv#12601 from cv3d:fix/js
  release: OpenCV 4.0.0-alpha (version++)
  cuda: move CUDA modules to opencv_contrib
  cmake: update install paths (Linux)
  Merge pull request opencv#12570 from alalek:drop_usrtype1
  Fix failure to request stddev of non-intrinsics
  ts: update valgrind test filter
  build: fix Xcode 10 build problems
  Enable Myriad device for OpenVINO models test
  ...
@alalek
Copy link
Copy Markdown
Member

alalek commented Oct 10, 2018

@dmatveev Could you please take a look on valgrind issues? (issue #12911)

a-sajjad72 pushed a commit to a-sajjad72/opencv that referenced this pull request Mar 30, 2023
* G-API Initial code upload

* Update G-API code base to Sep-24-2018

* The majority of OpenCV buildbot problems was addressed

* Update G-API code base to 24-Sep-18 EOD

* G-API code base update 25-Sep-2018

* Linux warnings should be resolved
* Documentation build should become green
* Number of Windows warnings should be reduced

* Update G-API code base to 25-Sep-18 EOD

* ARMv7 build issue should be resolved
* ADE is bumped to latest version and should fix Clang builds for macOS/iOS
* Remaining Windows warnings should be resolved
* New Linux32 / ARMv7 warnings should be resolved

* G-API code base update 25-Sep-2018-EOD2

* Final Windows warnings should be resolved now

* G-API code base update 26-Sep-2018

* Fixed issues with precompiled headers in module and its tests
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