Tensorflow:将预测导出到数组或文件

由于所有计算都是在会话下进行的,有没有办法将Tensorflow的预测导出到Numpy / Pandas数组或文件,即CSV或TXT?

谢谢 !
保罗

最佳答案 你想用…之类的东西

im = Image.open('/home/kendall/Desktop/HA900_frames/frame0635.tif')
batch_x = np.array(im)
batch_x = batch_x.reshape((1, n_steps, n_input))
batch_x = batch_x.astype(float)
prediction = sess.run(pred, feed_dict={x: batch_x})
prediction = np.asarray(prediction)
prediction = np.reshape(prediction, (200,200))
np.savetxt("prediction.csv", prediction, delimiter=",")
点赞