Skip to content

Commit ff8a624

Browse files
committed
Merge pull request opencv#19404 from LupusSanctus:am/text_graph_preproc
2 parents ca9cbab + 449ebc1 commit ff8a624

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

samples/dnn/tf_text_graph_ssd.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ def createSSDGraph(modelPath, configPath, outputPath):
122122
print('Input image size: %dx%d' % (image_width, image_height))
123123

124124
# Read the graph.
125-
_inpNames = ['image_tensor']
126125
outNames = ['num_detections', 'detection_scores', 'detection_boxes', 'detection_classes']
127126

128127
writeTextGraph(modelPath, outputPath, outNames)
@@ -247,6 +246,15 @@ def to_remove(name, op):
247246
graph_def.node[1].input.append(graph_def.node[0].name)
248247
graph_def.node[1].input.append(weights)
249248

249+
# check and correct the case when preprocessing block is after input
250+
preproc_id = "Preprocessor/"
251+
if graph_def.node[2].name.startswith(preproc_id) and \
252+
graph_def.node[2].input[0].startswith(preproc_id):
253+
254+
if not any(preproc_id in inp for inp in graph_def.node[3].input):
255+
graph_def.node[3].input.insert(0, graph_def.node[2].name)
256+
257+
250258
# Create SSD postprocessing head ###############################################
251259

252260
# Concatenate predictions of classes, predictions of bounding boxes and proposals.

0 commit comments

Comments
 (0)