Skip to content

Native ONNX to Inference Engine backend#21066

Merged
asmorkalov merged 2 commits intoopencv:4.xfrom
andrewerf:21052-openvino-native-onnx
Oct 20, 2023
Merged

Native ONNX to Inference Engine backend#21066
asmorkalov merged 2 commits intoopencv:4.xfrom
andrewerf:21052-openvino-native-onnx

Conversation

@andrewerf
Copy link
Copy Markdown
Contributor

@andrewerf andrewerf commented Nov 16, 2021

resolves #21052

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
  • The feature is well documented and sample code can be built with the project CMake
force_builders=Custom,Custom Win,Custom Mac
build_image:Custom=ubuntu-openvino-2021.4.2:20.04
build_image:Custom Win=openvino-2021.4.2
build_image:Custom Mac=openvino-2021.4.1

test_modules:Custom=dnn,python2,python3,java
test_modules:Custom Win=dnn,python2,python3,java
test_modules:Custom Mac=dnn,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.

Thank you for contribution!

@asmorkalov
Copy link
Copy Markdown
Contributor

@alalek @andrewerf Is the PR still relevant? Do you plan to finish it?

@asmorkalov asmorkalov requested a review from dmatveev May 5, 2023 08:13
@dmatveev
Copy link
Copy Markdown
Contributor

dmatveev commented May 5, 2023

@asmorkalov just checked the background & related issue and it seems it is not coming from the intel or openvino end -- so I can't help here. If the DNN module itself doesn't need this functionality, I believe the issue may be closed.

cc: @TolyaTalamanov probably you'd like to consider adding the direct ONNX support in your OV2.0 backend -- FYI

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.

No objections here, we may adopt the same way in G-API to load ONNX models directly into OV.

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.

No objections here, we may adopt the same way in G-API to load ONNX models directly into OV.

@dkurt dkurt self-assigned this Jun 13, 2023
andrewerf and others added 2 commits June 13, 2023 21:07
Overloaded readNetFromONNX taking backendId parameter.
Added static member function Net::readFromONNX.

More overloads in order to provide better interface for reading onnx models with IE.

Fixed build without IR (CV_UNUSED)
@dkurt dkurt force-pushed the 21052-openvino-native-onnx branch from f6cd760 to 52234eb Compare June 14, 2023 08:39
@TolyaTalamanov
Copy link
Copy Markdown
Contributor

@asmorkalov just checked the background & related issue and it seems it is not coming from the intel or openvino end -- so I can't help here. If the DNN module itself doesn't need this functionality, I believe the issue may be closed.

cc: @TolyaTalamanov probably you'd like to consider adding the direct ONNX support in your OV2.0 backend -- FYI

As far as I understood from openvino doc: https://docs.openvino.ai/2022.3/classov_1_1Core.html

std::shared_ptr<ov::Model> read_model(
    const std::string& model_path,
    const std::string& bin_path = {}
    ) const
    
For ONNX format (*.onnx) the bin_path parameter is not used

So, based on our current implementation: https://github.com/opencv/opencv/blob/4.x/modules/gapi/include/opencv2/gapi/infer/ov.hpp#L138

User can use onnx model like this:

cv::gapi::ov::Params params("model.onnx", "", "CPU");

@dkurt dkurt removed the pr: needs test New functionality requires minimal tests set label Jul 21, 2023
@opencv-alalek opencv-alalek added this to the 4.9.0 milestone Oct 17, 2023
Copy link
Copy Markdown
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.

@dkurt Thank you for the update!

*/
CV_EXPORTS_W
Net readNetFromModelOptimizer(const String &xml, const String &bin);
Net readNetFromModelOptimizer(const String &xml, const String &bin = "");
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.

= String() / std::string()

to avoid processing of unnecessary extra buffers

(other APIs have similar problem so it is better to resolve that in a separate PR)

Copy link
Copy Markdown
Contributor

@asmorkalov asmorkalov left a comment

Choose a reason for hiding this comment

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

👍

@asmorkalov asmorkalov merged commit b44cb33 into opencv:4.x Oct 20, 2023
@asmorkalov asmorkalov mentioned this pull request Nov 3, 2023
IskXCr pushed a commit to Haosonn/opencv that referenced this pull request Dec 20, 2023
…onnx

Native ONNX to Inference Engine backend opencv#21066

Resolves opencv#21052

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] 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
- [x] The PR is proposed to proper branch
- [x] 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
- [ ] The feature is well documented and sample code can be built with the project CMake
thewoz pushed a commit to thewoz/opencv that referenced this pull request Jan 4, 2024
…onnx

Native ONNX to Inference Engine backend opencv#21066

Resolves opencv#21052

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] 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
- [x] The PR is proposed to proper branch
- [x] 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
- [ ] The feature is well documented and sample code can be built with the project CMake
thewoz pushed a commit to thewoz/opencv that referenced this pull request May 29, 2024
…onnx

Native ONNX to Inference Engine backend opencv#21066

Resolves opencv#21052

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] 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
- [x] The PR is proposed to proper branch
- [x] 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
- [ ] The feature is well documented and sample code can be built with the project CMake
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.

Native ONNX to Inference Engine backend

7 participants