Corrected SSD text graph generation for Identity nodes#19417
Corrected SSD text graph generation for Identity nodes#19417alalek merged 2 commits intoopencv:3.4from
Conversation
2158e81 to
fd921a0
Compare
samples/dnn/tf_text_graph_common.py
Outdated
| if node.input[0] in identities: | ||
| identities[node.name] = identities[node.input[0]] | ||
| else: | ||
| identities[node.name] = node.input[0] |
There was a problem hiding this comment.
I think it make sense to make it more generic:
inp = node.input[0]
while inp in identities:
inp = identities[inp]
identities[node.name] = inpThere was a problem hiding this comment.
@dkurt, thank you for the review!
However, is there a possibility of random graph traversal or graph traversal from child nodes to parent or some particular Identity sequence case? If for node in graph_def.node: determines descending traversal from a parent node, then we don't need an extra while inp in identities: loop because we sequentially handle nodes and if there are two or more nodes of Identity type (ex.: a -> identity_0 [inp: a] -> identity_1 [inp: identity_0] -> ... -> identity_n [inp: identity_n-1] -> b [inp: identity_n]), we will check the presence of current identity node input in identities = {} and if it's there, we will add the current identity node to the identities = {}, overwriting its input value with the input value of initial identity.
There was a problem hiding this comment.
At this moment nodes order is sorted by execution (by writeTextGraph method).
2158e81 to
408e8e4
Compare
Resolves: #17484
Patch to opencv_extra has the same branch name.