Skip to content

fix ONNXImporter diagnostic mode layer registration issue#20494

Merged
alalek merged 6 commits intoopencv:masterfrom
rogday:onnx_diagnostic_fix
Aug 20, 2021
Merged

fix ONNXImporter diagnostic mode layer registration issue#20494
alalek merged 6 commits intoopencv:masterfrom
rogday:onnx_diagnostic_fix

Conversation

@rogday
Copy link
Copy Markdown
Member

@rogday rogday commented Aug 3, 2021

In diagnostic mode it showed that some layer isn't supported even if it was registered beforehand.

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
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake

* @brief Skip model import after diagnostic run in readNet() functions.
* @param[in] skip Indicates whether to skip the import.
*/
CV_EXPORTS void skipModelImport(bool skip);
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.

Why do we need that as part of public API?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This function is used in test_tf_importer.cpp and prevents tests of diagnostic mode from failing. I agree that users probably shouldn't care about this. I couldn't move the definition to dnn_common.hpp because of undefined reference error(implementation was placed in dnn.cpp). Can you suggest a better place for it or how to get around this problem?

As for the contents of layer_reg.private.hpp, I think removing it would be a breaking change, and so if someone is using it, they should be able to use it thread-safely.

@rogday rogday force-pushed the onnx_diagnostic_fix branch from dc07424 to 901b810 Compare August 9, 2021 14:28
…f DNN_DIAGNOSTICS_RUN between onnx and tf importers
@rogday rogday force-pushed the onnx_diagnostic_fix branch from 901b810 to 71c09c2 Compare August 9, 2021 14:52
@rogday rogday force-pushed the onnx_diagnostic_fix branch 2 times, most recently from 60b1d5d to 3960253 Compare August 11, 2021 11:16
@rogday rogday marked this pull request as ready for review August 11, 2021 13:26
@rogday rogday force-pushed the onnx_diagnostic_fix branch from 3960253 to 34f7f56 Compare August 11, 2021 13:26
@asmorkalov asmorkalov requested a review from alalek August 16, 2021 11:19
@rogday rogday force-pushed the onnx_diagnostic_fix branch from 0ae1190 to e286cc2 Compare August 16, 2021 16:14
@asmorkalov
Copy link
Copy Markdown
Contributor

asmorkalov commented Aug 20, 2021

@alalek The failed test is not related to Rogday's changes. Could you take a look.


Issue about sporadic test failure is here: #10400

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.

Looks good to me! Thank you 👍

@rogday rogday marked this pull request as draft August 20, 2021 12:18
@rogday
Copy link
Copy Markdown
Member Author

rogday commented Aug 20, 2021

I found an error in TF logic.

@rogday rogday marked this pull request as ready for review August 20, 2021 12:25
@asmorkalov asmorkalov requested a review from alalek August 20, 2021 14:21
@alalek alalek merged commit 6801dd0 into opencv:master Aug 20, 2021
@rogday rogday deleted the onnx_diagnostic_fix branch October 7, 2021 13:15
@alalek alalek mentioned this pull request Oct 15, 2021
a-sajjad72 pushed a commit to a-sajjad72/opencv that referenced this pull request Mar 30, 2023
fix ONNXImporter diagnostic mode layer registration issue

* fix layer registration, thread unsafe access and align the behavior of DNN_DIAGNOSTICS_RUN between onnx and tf importers

* move skipModelInput

* print all missing layers

* address TF issue
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