dnn.tf_text_graph_mask_rcnn出现assertgraph_def.node[0].op == 'Placeholder'问题)
解决方法
import tensorflow as tf
from tensorflow.tools.graph_transforms import TransformGraph
'''
转化frozen_inference_graph.pb到新的.pb,以解决assert(graph_def.node[0].op == 'Placeholder')的问题
'''
with tf.gfile.FastGFile('D:/代码/models-master/g2_model/frozen_inference_graph.pb', 'rb') as f:
graph_def = tf.GraphDef()
graph_def.ParseFromString(f.read())
graph_def = TransformGraph(graph_def, ['image_tensor'], ['num_detections', 'detection_scores', 'detection_boxes', 'detection_classes', 'detection_masks'], ['sort_by_execution_order'])
with tf.gfile.FastGFile('D:/代码/models-master/g2_model/frozen_inference_graph_converted.pb', 'wb') as f:
f.write(graph_def.SerializeToString())#保存新的pb
然后利用tf_text_graph_mask_rcnn调用改.pb