@@ -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:
0 commit comments