Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@olpipi
Copy link
Contributor

@olpipi olpipi commented Mar 11, 2024

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 another license that is incompatible with OpenCV
  • The PR is proposed to the proper branch
  • There is a reference to the 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

@olpipi olpipi force-pushed the fix_openvino_2024_0 branch from 7675ec1 to 0fabe2b Compare March 11, 2024 16:51
@dkurt dkurt linked an issue Mar 11, 2024 that may be closed by this pull request
@dkurt
Copy link
Member

dkurt commented Mar 11, 2024

Thanks, @olpipi! Our CI uses OpenVINO 2023.0.2.

Can you determine on which minimal version ov:: namespace and required headers are available? To understand which would be a minimal required version to support.

@olpipi
Copy link
Contributor Author

olpipi commented Mar 11, 2024

Thanks, @olpipi! Our CI uses OpenVINO 2023.0.2.

Can you determine on which minimal version ov:: namespace and required headers are available? To understand which would be a minimal required version to support.

Hi
No problem. I'll check it

@dkurt
Copy link
Member

dkurt commented Mar 11, 2024

Please note that as a part of regular CI we test 2021.4.2 release (OpenVINO API 1.0): https://pullrequest.opencv.org/buildbot/builders/4_x_openvino-opencl-skl-lin64/builds/100055

If there is no ov namespace in 2021.4.2, I still recommend to replace ngraph:: to ov:: however with a workaround for old release:

namespace ov = ngraph;

@olpipi
Copy link
Contributor Author

olpipi commented Mar 12, 2024

@dkurt OpenVINO 2021.4.2 has neither ov namespace nor "openvino/..." include pathes. So I'll fix it as you suggested.

Can we somehow test it with 2024.0 release as well, except my local testing?

@dkurt dkurt marked this pull request as ready for review March 13, 2024 11:00
@dkurt dkurt marked this pull request as draft March 13, 2024 11:00
#include "opencl_kernels_dnn.hpp"
#endif

#ifdef HAVE_DNN_NGRAPH
Copy link
Contributor

Choose a reason for hiding this comment

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

HAVE_DNN_NGRAPH => HAVE_DNN_OPENVINO ?

Copy link
Member

Choose a reason for hiding this comment

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

Will cost a lot of changes as well as DNN_BACKEND_INFERENCE_ENGINE -> DNN_BACKEND_OPENVINO.


#include "op_inf_engine.hpp"

#ifdef HAVE_INF_ENGINE
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
#ifdef HAVE_INF_ENGINE
#ifdef HAVE_OPENVINO


std::string model; model.assign((char*)bufferModelConfigPtr, bufferModelConfigSize);

InferenceEngine::CNNNetwork ieNet;
Copy link
Contributor

Choose a reason for hiding this comment

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

it's removed in API 2.0

Copy link
Member

Choose a reason for hiding this comment

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

This is a workaround to wrap ov::Model from API 2.0: https://github.com/opencv/opencv/pull/25199/files#r1524623439

#include "op_inf_engine.hpp"
#include <opencv2/dnn/shape_utils.hpp>

#ifdef HAVE_INF_ENGINE
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
#ifdef HAVE_INF_ENGINE
#ifdef HAVE_OPENVINO

#define INF_ENGINE_RELEASE_2021_4 2021040000
#define INF_ENGINE_RELEASE_2022_1 2022010000
#define INF_ENGINE_RELEASE_2023_0 2023000000
#define INF_ENGINE_RELEASE_2024_0 2024000000
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
#define INF_ENGINE_RELEASE_2024_0 2024000000
#define OPENVINO_RELEASE_2024_0 2024000000

and can we remove old ones?

Copy link
Member

Choose a reason for hiding this comment

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

Let’s remove old ones, but keep IE notation to reduce changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@dkurt dkurt linked an issue Mar 14, 2024 that may be closed by this pull request
3 tasks
@dkurt dkurt changed the title Fix for OpenVINO 2024.0 Fix for OpenVINO 2024.0. OpenVINO 2022.1 as minimal supported version. Mar 14, 2024
@opencv-alalek opencv-alalek added optimization feature category: dnn category: 3rdparty cleanup Code cleanup (e.g, drop legacy C-API, legacy unmaintained code) labels Mar 14, 2024
@olpipi olpipi marked this pull request as ready for review March 14, 2024 15:30
@olpipi olpipi marked this pull request as draft March 14, 2024 15:30
@olpipi olpipi marked this pull request as ready for review March 14, 2024 19:24
Copy link
Member

@dkurt dkurt left a comment

Choose a reason for hiding this comment

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

Great job, many thanks!

@dkurt dkurt requested a review from opencv-alalek March 15, 2024 12:26
@olpipi
Copy link
Contributor Author

olpipi commented Mar 18, 2024

Hi @dkurt.
Can we merge this PR or any extra actions are required?

@dkurt
Copy link
Member

dkurt commented Mar 18, 2024

@olpipi, Need a comment from @opencv-alalek regarding https://pullrequest.opencv.org/buildbot/builders/4_x_openvino-opencl-skl-lin64/ (uses 2021.4.2 OpenVINO). Is that critical if we merge this PR to 4.x before CI upgrade?

Copy link
Contributor

@opencv-alalek opencv-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 👍

@olpipi Please squash commits into one before merge


OpenVINO builder on legacy CI will be upgraded later.

Remove support OpenVINO lower than 2022.1 release
Remove legacy InferenceEngine wrappers
@olpipi olpipi force-pushed the fix_openvino_2024_0 branch from 9e9b879 to 6da2ddc Compare March 18, 2024 11:06
@olpipi
Copy link
Contributor Author

olpipi commented Mar 18, 2024

Well done 👍

@olpipi Please squash commits into one before merge

OpenVINO builder on legacy CI will be upgraded later.

Done. Squashed and rebased

@CSBVision
Copy link
Contributor

After OpenCV's 4.10.0 release including this patch, we tried to upgrade to OpenVINO 2024, too. However, compiling OpenVINO 2024.2.0 with basically only the CPU plugin, linking OpenCV against it and using model.setPreferableBackend(cv.dnn.DNN_BACKEND_INFERENCE_ENGINE), we get the following runtime error in model.forward():

error: OpenCV(4.10.0) opencv\modules\dnn\src\ie_ngraph.cpp:558: error: (-215:Assertion failed) blobIt != allBlobs.end() in function 'cv::dnn::InfEngineNgraphNet::forward'

Ìt works without any issues if either OpenCV's backend is used or the OpenVINO's 2024 release is replaced by 2023 (we tested 2023.3.0), i.e. it is directly caused by using OpenVINO's 2024 release. We also tested different models, the error is always the same. Any ideas what's causing it?

@asmorkalov
Copy link
Contributor

@CSBVision could you file a bug with small reproducer and particular OpenVINO versions.

@CSBVision
Copy link
Contributor

Sure, no problem, cf. #25916
We only wanted to discuss the issue here before opening a new one.

AvenSun added a commit to AvenSun/opencv that referenced this pull request Aug 3, 2024
@asmorkalov asmorkalov mentioned this pull request Aug 6, 2024
fengyuentau pushed a commit to fengyuentau/opencv that referenced this pull request Aug 15, 2024
thewoz pushed a commit to CobbsLab/OPENCV that referenced this pull request Feb 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: dnn category: 3rdparty cleanup Code cleanup (e.g, drop legacy C-API, legacy unmaintained code) feature optimization

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Drop old OpenVINO support OpenVINO nGraph API will be removed in 2024

8 participants