from tensorflow.examples.tutorials.mnist import input_data
import scipy.misc
import os
# 注意保存的路径
mnist = input_data.read_data_sets("MNIST_DATA", one_hot=True)
save_dir = "pictures/"
if os.path.exists(save_dir) is False:
os.makedirs(save_dir)
for i in range(100):
image_array = mnist.test.images[i, :]
image_array = image_array.reshape(28, 28)
filename = save_dir + "mnist_test_%d.jpg" % (i)
scipy.misc.toimage(image_array, cmin=0.0, cmax=1.0).save(filename)
将mnist数据转成图片
最新推荐文章于 2020-06-22 16:33:39 发布