Skip to content

Instantly share code, notes, and snippets.

@grim13b
Last active January 1, 2016 12:05
Show Gist options
  • Save grim13b/501978d8158d71526975 to your computer and use it in GitHub Desktop.
Save grim13b/501978d8158d71526975 to your computer and use it in GitHub Desktop.
TensorFlowのtutorialにあるmnistデータをImageで表示する
%matplotlib inline
import tensorflow.examples.tutorials.mnist.input_data as input_data
import numpy
import matplotlib.pyplot as pyplot
import matplotlib.cm as cm
from PIL import Image
mnist = input_data.read_data_sets('./MNIST_data', one_hot=True)
data = mnist.train
pyplot.imshow(Image.fromarray(numpy
.uint8(data.images[0] * 255)
.reshape(28, 28))
, cmap = cm.Greys_r)
print('Number:{0}'.format(data.labels[0].argmax()))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment