From cc584760d3b631fb1c8a6a3d4240fc0d9f59a856 Mon Sep 17 00:00:00 2001 From: Dmitry Kurtaev Date: Wed, 15 Jul 2020 14:36:13 +0300 Subject: [PATCH] Fix TensorFlow->ONNX imports --- modules/dnn/src/graph_simplifier.cpp | 3 --- modules/dnn/src/tensorflow/tf_graph_simplifier.cpp | 5 ++++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/dnn/src/graph_simplifier.cpp b/modules/dnn/src/graph_simplifier.cpp index 166564c..a23fce3 100644 --- a/modules/dnn/src/graph_simplifier.cpp +++ b/modules/dnn/src/graph_simplifier.cpp @@ -63,9 +63,6 @@ int Subgraph::getInputNodeId(const Ptr& net, { CV_Assert(inpId < node->getNumInputs()); std::string name = node->getInputName(inpId); - // If operation produces several tensors, they are specified by index - // after ':' character. In example, "input:0". - name = name.substr(0, name.rfind(':')); const int numNodes = net->getNumNodes(); for (int i = 0; i < numNodes; ++i) { diff --git a/modules/dnn/src/tensorflow/tf_graph_simplifier.cpp b/modules/dnn/src/tensorflow/tf_graph_simplifier.cpp index ef9e68a..354fef0 100644 --- a/modules/dnn/src/tensorflow/tf_graph_simplifier.cpp +++ b/modules/dnn/src/tensorflow/tf_graph_simplifier.cpp @@ -31,7 +31,10 @@ public: virtual std::string getInputName(int idx) const CV_OVERRIDE { - return node->input(idx); + // If operation produces several tensors, they are specified by index + // after ':' character. In example, "input:0". + std::string name = node->input(idx); + return name.substr(0, name.rfind(':')); } virtual std::string getType() const CV_OVERRIDE -- 2.7.4