Skip to content

Fix bug while loading onnx model in debug#20374

Merged
alalek merged 2 commits intoopencv:3.4from
cesarpgouveia:bugfix/fix_load_onnxModel_debug
Jul 9, 2021
Merged

Fix bug while loading onnx model in debug#20374
alalek merged 2 commits intoopencv:3.4from
cesarpgouveia:bugfix/fix_load_onnxModel_debug

Conversation

@cesarpgouveia
Copy link
Copy Markdown
Contributor

@cesarpgouveia cesarpgouveia commented Jul 7, 2021

PR description

  • Fixed bug while loading onnx model in debug. Blob is 4d and you are trying to access it with at() which is 2d. This error does not occur in Release because CV_DbgAssert only asserts under debug. For more info please check lines 937-950 of \opencv\modules\core\include\opencv2\core\mat.inl.hpp.

@alalek
Copy link
Copy Markdown
Member

alalek commented Jul 7, 2021

@cesarpgouveia Thank you for contribution!

Does this problem reproducible with opencv_test_dnn? Or you have run another model?

@cesarpgouveia
Copy link
Copy Markdown
Contributor Author

cesarpgouveia commented Jul 7, 2021

Hi @alalek !

Does this problem reproducible with opencv_test_dnn? Or you have run another model?

I haven't tested with 'opencv_test_dnn' but I don't think the problem happens in that test. The problem was caused while loading a specific architecture of mine that uses 1x1 convolutions (in order to replace dot layers). However I can try to run opencv_test_dnn in debug tomorrow and see what happens.

@alalek
Copy link
Copy Markdown
Member

alalek commented Jul 8, 2021

Got it.
Looks like this problem is not reproducible with opencv_test_dnn (with used test models) on debug build (unable to reproduce it locally).

@alalek
Copy link
Copy Markdown
Member

alalek commented Jul 8, 2021

I fixed other similar cases too (in more robust way).
Also this patch is rebased on 3.4 branch: https://github.com/opencv/opencv/wiki/Branches
Please check updated patch with your model.

@cesarpgouveia
Copy link
Copy Markdown
Contributor Author

I fixed other similar cases too (in more robust way).

Alright I see what you did on the code changes!

Also this patch is rebased on 3.4 branch: https://github.com/opencv/opencv/wiki/Branches
Please check updated patch with your model.

I didn't fully understand your question. I discover this while testing in the most recent version of opencv (4.5.3). Do you want me to follow this process (rebasing to 3.4, is that it)? https://github.com/opencv/opencv/wiki/Branches#rebasing-a-pull-request-from-master-to-34

Thanks, César.

@alalek
Copy link
Copy Markdown
Member

alalek commented Jul 8, 2021

Do you want me to follow this process (rebasing to 3.4, is that it)?

No. The patch is already rebased to 3.4 branch.

Please check it locally in your environment (you can cherry-pick commit the last commit, no "conflicts" are expected here).

@alalek alalek merged commit 167a120 into opencv:3.4 Jul 9, 2021
@alalek alalek mentioned this pull request Jul 10, 2021
@alalek alalek mentioned this pull request Oct 15, 2021
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.

2 participants