Skip to content

Use modern OpenVINO package interface#21452

Merged
opencv-pushbot merged 1 commit intoopencv:4.xfrom
mshabunin:ov-pkg
Feb 1, 2022
Merged

Use modern OpenVINO package interface#21452
opencv-pushbot merged 1 commit intoopencv:4.xfrom
mshabunin:ov-pkg

Conversation

@mshabunin
Copy link
Copy Markdown
Contributor

@mshabunin mshabunin commented Jan 14, 2022

  • new cmake options: WITH_OPENVINO, OPENCV_GAPI_WITH_OPENVINO, old options are deprecated
  • old options will be ignored if new options have been set
  • tested with current OpenVINO@master

Notes:

  • OpenVINO version will be autodetected, can not be changed manually anymore (INF_ENGINE_RELEASE)
  • not possible to disable ngraph integration when OpenVINO is enabled (is it necessary?)

Validation:

force_builders=Custom,Custom Win,Custom Mac

Xbuild_image:Custom=ubuntu-openvino-2021.4.2:20.04
build_image:Custom=ubuntu-openvino-2022.1.0.dev20220131:20.04
build_image:Custom Win=openvino-2021.4.2
build_image:Custom Mac=openvino-2021.4.2

test_modules:Custom=dnn,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=*

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.

Need to try to preserve compatibility of legacy user options.

@mshabunin
Copy link
Copy Markdown
Contributor Author

@alalek , do you mean compatibility of WITH_OPENVINO and OPENCV_GAPI_INF_ENGINE? I think we should consider that legacy users have WITH_INF_ENGINE + OPENCV_GAPI_INF_ENGINE and new users have WITH_OPENVINO + OPENCV_GAPI_WITH_OPENVINO. Any different combination is wrong and we will print a warning in this case.

message(STATUS "DNN: Enabling OpenVINO Toolkit support")
math(EXPR OV_VER "${OpenVINO_VERSION_MAJOR} * 1000000 + ${OpenVINO_VERSION_MINOR} * 10000 + ${OpenVINO_VERSION_PATCH} * 100")
# TODO: rename definitions
add_definitions("-DHAVE_DNN_NGRAPH" "-DHAVE_INF_ENGINE=1" "-DINF_ENGINE_RELEASE=${OV_VER}")
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.

G-API also uses INF_ENGINE_RELEASE variable.

Could we reuse ocv_add_external_target() approach with added definitions?

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.

Done! I've added ocv.3rdparty.openvino interface target with dependencies on IE and ngraph or whole OpenVINO. It seem to be working with OpenVINO@master and 2021.4 package.

Also removed OPENCV_DNN_IE_NN_BUILDER_2019 option from cmake. I did not remove it from the code to avoid conflicts.

Apparently, -DWITH_INF_ENGINE=ON -DWITH_NGRAPH=OFF does not work on current 4.x branch (with 2021.4), I didn't try to fix it. Looks like nobody uses such configuration and future OpenVINO versions will not have separation between these components.

@mshabunin
Copy link
Copy Markdown
Contributor Author

Rebased to latest 4.x along with changes from https://github.com/alalek/opencv/tree/pr21452_r

@alalek
Copy link
Copy Markdown
Member

alalek commented Feb 1, 2022

Rebased to resolve modules/gapi/CMakeLists.txt conflict

@opencv-pushbot opencv-pushbot merged commit 415a42f into opencv:4.x Feb 1, 2022
@alalek alalek mentioned this pull request Feb 22, 2022
@mshabunin mshabunin deleted the ov-pkg branch July 10, 2023 08:13
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