Paul Rolin
Paul Rolin

Reputation: 443

Tensorflow : Export predictions to an array or a file

As all the computations are made under a session, is there a way to export the predictions of Tensorflow to a Numpy/Pandas array or a file, i.e. CSV or TXT ?

Thanks ! Paul

Upvotes: 4

Views: 5529

Answers (1)

Kendall Weihe
Kendall Weihe

Reputation: 2075

You want to use something like...

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

Upvotes: 2

Related Questions