Skip to content

(3.4) dnn: support outputs registration under new names#21540

Merged
opencv-pushbot merged 2 commits intoopencv:3.4from
alalek:dnn_support_outputs_registration_3.4
Jan 31, 2022
Merged

(3.4) dnn: support outputs registration under new names#21540
opencv-pushbot merged 2 commits intoopencv:3.4from
alalek:dnn_support_outputs_registration_3.4

Conversation

@alalek
Copy link
Copy Markdown
Member

@alalek alalek commented Jan 29, 2022

continues #21490

TODO:

  • (backlog) add test with validation of ONNX output names (query / forward)
  • (backlog) emit compatibility message
allow_multiple_commits=1

- ONNX output is 1 tensor per defined output instead of N tensors from outputs of "output" layer
@alalek
Copy link
Copy Markdown
Member Author

alalek commented Jan 31, 2022

👍


int registerOutput(const std::string& outputName, int layerId, int outputPort)
{
int checkLayerId = getLayerId(outputName);
Copy link
Copy Markdown
Member

@rogday rogday Mar 14, 2022

Choose a reason for hiding this comment

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

GetLayerId operates on names of layer, instead of names of outputs of layers, which causes #21698. Not sure yet how to fix this. We might want to revert #21490.

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.

GetLayerId operates on names of layer

It is correct.

instead of names of outputs of layers

I believe output names should not be used during the network construction (it uses internal "nodes" names).
Also output could not be replaced by layer (layers may have multiple output ports)


registerOutput function tries to create dummy "Identity" layer with "required name" (in the end of network construction).
checkLayerId is just a check to avoid duplicates, replacement and inconsistent state of network (dnn still doesn't support "outputs" properly and rely on "unconnected layers" - we need new API for that).

Did you observe error with message: "Layer with name='%s' already exists id=%d (to be linked with %d:%d)"?

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.

Yes, I did. It happened because the net contains layer with name X, followed by a layer with output named X, hence the error: we mix up layer name with layer 's output name.

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