Skip to content

Commit 8869985

Browse files
committed
Merge pull request opencv#595 from dkurt:tf_squeeze_and_slim_softmax_v2
2 parents 1524ee6 + b146cb1 commit 8869985

File tree

4 files changed

+21
-0
lines changed

4 files changed

+21
-0
lines changed

testdata/dnn/tensorflow/generate_tf_models.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -703,6 +703,27 @@ def pad_depth(x, desired_channels):
703703
f.write(graph_def.SerializeToString())
704704

705705
################################################################################
706+
# issue https://github.com/opencv/opencv/issues/13839
707+
inp_node = 'PNet/conv3/add'
708+
out_node = 'PNet/cls_prob'
709+
with tf.Session(graph=tf.Graph()) as localSession:
710+
localSession.graph.as_default()
711+
712+
with tf.gfile.FastGFile('PNet_pnet.pb') as f:
713+
graph_def = tf.GraphDef()
714+
graph_def.ParseFromString(f.read())
715+
graph_def = TransformGraph(graph_def, [inp_node], [out_node], ['strip_unused_nodes'])
716+
717+
tf.import_graph_def(graph_def, name='')
718+
719+
inputData = gen_data(tf.placeholder(tf.float32, [1, 4, 5, 16], inp_node))
720+
outputData = localSession.run(localSession.graph.get_tensor_by_name(out_node + ':0'),
721+
feed_dict={inp_node + ':0': inputData})
722+
writeBlob(inputData, 'slim_softmax_v2_in')
723+
writeBlob(outputData, 'slim_softmax_v2_out')
724+
725+
with tf.gfile.FastGFile('slim_softmax_v2_net.pb', 'wb') as f:
726+
f.write(graph_def.SerializeToString())
706727

707728
# Uncomment to print the final graph.
708729
# with tf.gfile.FastGFile('fused_batch_norm_net.pb') as f:
1.33 KB
Binary file not shown.
2.09 KB
Binary file not shown.
240 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)