Replace Slice optional inputs removal to adjustment#24672
Replace Slice optional inputs removal to adjustment#24672asmorkalov merged 1 commit intoopencv:4.xfrom
Conversation
| { | ||
| opencv_onnx::NodeProto* node = fusedNode.dynamicCast<ONNXNodeWrapper>()->node; | ||
| for (int i = num_inputs_; i < 5; ++i) { | ||
| node->add_input(""); |
There was a problem hiding this comment.
Doesn't it lose connections to the existing constants (starts, ends, axes and steps)?
There was a problem hiding this comment.
No, It should append missed connections to axes and steps pointing to a fake empty initializer added by
There was a problem hiding this comment.
How does this appending happen? What I see here is input names are missed already.
There was a problem hiding this comment.
For example, node which found with 3 real inputs (data, starts, ends) is appended up to 5 inputs with add_input:
inputs: "data_name", "starts_name", "ends_name", "", ""
net.add_initializer(); adds an empty tensor with an empty name. So the final version of the Slice refers to it.
I have observed such behavior with resize_nearest_unfused_opset11_torch1.4 model:

There was a problem hiding this comment.
Yes, I got you point here. But actually my problem is why this
- setFusedNode("Slice", std::vector<int>{input, starts, ends});
+ setFusedNode("Slice", inputs);does not drop the starts and ends constants.
There was a problem hiding this comment.
Ahhh, sorry, I missed that. I thought it was input.
There was a problem hiding this comment.
@dkurt is there a way for me to check these fixes locally before merging? Wanna make sure if yolox test do pass.
There was a problem hiding this comment.
@Abdurrahheem, do the following:
git remote add dkurt https://github.com/dkurt/opencv
git fetch dkurt adjust_slice_optional_inputs
git checkout dkurt/adjust_slice_optional_inputs
There was a problem hiding this comment.
@dkurt is there a way for me to check these fixes locally before merging? Wanna make sure if yolox test do pass.
git cherry-pick should also work right? The simplest way is do the same changes as this PR manually, so you don’t need to mess around with git operations.
There was a problem hiding this comment.
@dkurt just checked test with the new patch. Everything related to yolo detectors passes. Thank you for a quick fix!
Pull Request Readiness Checklist
resolves #24671
related discussion: #24655 (comment)
TODO:
patch
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.