【问题标题】:Tensorflow : Export predictions to an array or a fileTensorflow:将预测导出到数组或文件
【发布时间】:2016-10-19 16:53:58
【问题描述】:

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

谢谢! 保罗

【问题讨论】:

  • 你会在 python 领域得到结果,所以你应该能够使用任何 python 示例。我可能会创建一个results 对象(Numpy/Pandas/list),然后将sess.run 的结果附加到该对象上,完成后将其写出来。
  • 同意雅各布。雅各布,你能把你的笔记复制到一个答案上,这样我就可以投票给你吗? :) :)
  • 不知道为什么我没想到...谢谢!保罗

标签: tensorflow export-to-csv


【解决方案1】:

你想使用类似...

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=",")

【讨论】:

    猜你喜欢
    • 2018-02-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-10-09
    • 2020-04-05
    • 1970-01-01
    • 2020-02-02
    相关资源
    最近更新 更多