Skip to content

Avoid copy of ONNX graph during import#25163

Merged
asmorkalov merged 1 commit intoopencv:4.xfrom
dkurt:onnx_graph_ref
Mar 6, 2024
Merged

Avoid copy of ONNX graph during import#25163
asmorkalov merged 1 commit intoopencv:4.xfrom
dkurt:onnx_graph_ref

Conversation

@dkurt
Copy link
Copy Markdown
Member

@dkurt dkurt commented Mar 5, 2024

Pull Request Readiness Checklist

Initializing graph by value creates a copy of entire model. Use a pointer instead.

readNet top resident memory on vit_b_32.onnx (339MB file):

4.x PR
723MB 375MB
  • 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

Copy link
Copy Markdown
Member

@fengyuentau fengyuentau 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 66ff710 into opencv:4.x Mar 6, 2024
@dkurt dkurt deleted the onnx_graph_ref branch March 6, 2024 07:24
@asmorkalov asmorkalov mentioned this pull request Mar 6, 2024
@asmorkalov asmorkalov mentioned this pull request Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: dnn (onnx) ONNX suport issues in DNN module optimization

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants