TensorFlow - Show image from MNIST DataSet TensorFlow - Show image from MNIST DataSet python python

TensorFlow - Show image from MNIST DataSet


After reading the tutorial you can do it all in numpy no need for TF:

import matplotlib.pyplot as pltfirst_array=batch_xs[0]#Not sure you even have to do that if you just want to visualize it#first_array=255*first_array#first_array=first_array.astype("uint8")plt.imshow(first_array)#Actually displaying the plot if you are not in interactive modeplt.show()#Saving plotplt.savefig("fig.png")

You can also use PIL or whatever visualization tool you are into.


X = X.reshape([28, 28]);plt.gray()plt.imshow(X)

this works.


On top of the codes in the tutorial MNIST for ML beginners, you can visualize the image in the mnist dataset:

import matplotlib.pyplot as pltbatch = mnist.train.next_batch(1)plotData = batch[0]plotData = plotData.reshape(28, 28)plt.gray() # use this line if you don't want to see it in colorplt.imshow(plotData)plt.show()

enter image description here