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

Skip to content

Conversation

@Abdurrahheem
Copy link
Contributor

This PR fixes Slice Layer's parser to handle empty input cases (cases with initializer)
It fixed the issue rased in #24838

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

@Abdurrahheem Abdurrahheem requested a review from asmorkalov May 28, 2024 08:27
@Abdurrahheem Abdurrahheem self-assigned this May 28, 2024
@Abdurrahheem Abdurrahheem requested a review from dkurt May 28, 2024 08:28
@Abdurrahheem Abdurrahheem added this to the 4.10.0 milestone May 28, 2024
@Abdurrahheem Abdurrahheem added the category: dnn (onnx) ONNX suport issues in DNN module label May 28, 2024
@asmorkalov asmorkalov marked this pull request as ready for review May 28, 2024 10:10
{
MatShape inpShape = outShapes[node_proto.input(0)];
MatShape inpShape;
if (constBlobs.find(node_proto.input(0)) != constBlobs.end() && outShapes[node_proto.input(0)].empty())
Copy link
Member

Choose a reason for hiding this comment

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

Why we need to check for empty shapes if the question is to handle constant or variable input?

Copy link
Contributor Author

@Abdurrahheem Abdurrahheem May 31, 2024

Choose a reason for hiding this comment

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

The idea is to catch cases when there is no input (which is effectively an empty shape) and check whether an input is found in the constants. Probably, I should add on more branches that ACCERTS that at least one of these conditions is true.

Copy link
Member

Choose a reason for hiding this comment

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

I used to think that constBlobs.find(node_proto.input(0)) != constBlobs.end() is enough to catch constant input.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I used to think that constBlobs.find(node_proto.input(0)) != constBlobs.end() is enough to catch constant input.

In reality, this that enough. I just added it to make sure that we catch exactly the case I am talking about since I was not sure if constBlobs get filled on when there is one input.

If this is crucial I can remove the other part of condition

Copy link
Member

Choose a reason for hiding this comment

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

Yes, let's remove please until we find a proper reproducer

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants