Tensorflow会话运行中的批量预测

时间:2018-10-03 12:55:05

标签: python tensorflow

我对Tensorflow还是很陌生,我想知道何时加载冻结的图进行预测,是否可以像在keras中那样进行批处理预测。

我的代码在Tensorflow中如下所示:

path='some_path.pb'
with dgraph.as_default():
     od_graph_def=tf.GraphDef()
     with tf.gfile.GFile(path,'rb') as fid:
          serialized_graph=fid.read()
          od_graph_def.ParseFromString(serialized_graph)
          tf.import_graph_def(od_graph_def,name='')
sess = tf.Session(graph=dgraph)   

feat_5=detection_graph.get_tensor_by_name('Relu6:0')
input=np.random.randn(100,300,300,3)

sess.run([feat_5],feed_dict={image_tensor: input}) **want to add batches of data here instead of input directly

0 个答案:

没有答案
相关问题