From 449ebc1b704886bfe7e1e7204060c626278497a0 Mon Sep 17 00:00:00 2001 From: Anastasia Murzova Date: Wed, 27 Jan 2021 00:59:10 +0300 Subject: [PATCH] Corrected SSD text graph generation --- samples/dnn/tf_text_graph_ssd.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/samples/dnn/tf_text_graph_ssd.py b/samples/dnn/tf_text_graph_ssd.py index 46a9064738..dbdee6ea9f 100644 --- a/samples/dnn/tf_text_graph_ssd.py +++ b/samples/dnn/tf_text_graph_ssd.py @@ -122,7 +122,6 @@ def createSSDGraph(modelPath, configPath, outputPath): print('Input image size: %dx%d' % (image_width, image_height)) # Read the graph. - _inpNames = ['image_tensor'] outNames = ['num_detections', 'detection_scores', 'detection_boxes', 'detection_classes'] writeTextGraph(modelPath, outputPath, outNames) @@ -247,6 +246,15 @@ def createSSDGraph(modelPath, configPath, outputPath): graph_def.node[1].input.append(graph_def.node[0].name) graph_def.node[1].input.append(weights) + # check and correct the case when preprocessing block is after input + preproc_id = "Preprocessor/" + if graph_def.node[2].name.startswith(preproc_id) and \ + graph_def.node[2].input[0].startswith(preproc_id): + + if not any(preproc_id in inp for inp in graph_def.node[3].input): + graph_def.node[3].input.insert(0, graph_def.node[2].name) + + # Create SSD postprocessing head ############################################### # Concatenate predictions of classes, predictions of bounding boxes and proposals.