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

Skip to content

Conversation

zihaomu
Copy link
Member

@zihaomu zihaomu commented Oct 31, 2022

Related issue: #22709

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

@zihaomu zihaomu added the bug label Oct 31, 2022
@zihaomu zihaomu requested a review from asmorkalov October 31, 2022 07:40
@zihaomu zihaomu changed the title DNN: fixed the infinite loop at tensorflow importer DNN: report an error at the infinite loop of tensorflow importer Oct 31, 2022
@zihaomu zihaomu linked an issue Oct 31, 2022 that may be closed by this pull request
4 tasks
@zihaomu
Copy link
Member Author

zihaomu commented Oct 31, 2022

Hi, should I add the test file supplied at issue #22709?

IdentityOpsMap::iterator it = identity_ops.find(input_op_name);

if (it != identity_ops.end()) {
std::vector<IdentityOpsMap::iterator> itVec;
Copy link
Member

Choose a reason for hiding this comment

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

What is observed size of this container for valid models?
If it is a large (>50 items) then we should try std::set here.


itVec -> loopCheck / duplicateCheck / other descriptive name.

Copy link
Member Author

@zihaomu zihaomu Oct 31, 2022

Choose a reason for hiding this comment

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

Thanks for your code review.
Different models may have different itVec sizes. Since it just put the item in identity_ops to itVec, the size of identity_ops is the max number.
From my point of view, the maximum size of identity_ops should be less than 50. I agree with you, the std::set should be more reasonable.

@zihaomu zihaomu force-pushed the fix_infinit_loop_in_tf branch from f2b1889 to 18fbb72 Compare October 31, 2022 12:11
@opencv-pushbot opencv-pushbot merged commit ee9137f into opencv:4.x Oct 31, 2022
@zihaomu zihaomu deleted the fix_infinit_loop_in_tf branch November 6, 2022 01:53
@asmorkalov
Copy link
Contributor

@zihaomu could you port the solution back to 3.4 too?

@zihaomu
Copy link
Member Author

zihaomu commented Nov 14, 2022

@asmorkalov sure. I'm working on it.

@zihaomu zihaomu mentioned this pull request Nov 14, 2022
6 tasks
@alalek alalek mentioned this pull request Jan 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug category: dnn port/backport done Label for maintainers. Authors of PR can ignore this

Projects

None yet

Development

Successfully merging this pull request may close these issues.

An infinite loop in function cv::dnn::readNetFromTensorflow()

4 participants