tensorflow 基础学习五:MNIST手写数字识别

MNIST数据集介绍:

from tensorflow.examples.tutorials.mnist import input_data # 载入MNIST数据集,如果指定地址下没有已经下载好的数据,tensorflow会自动下载数据 mnist=input_data.read_data_sets(\'.\',one_hot=True) # 打印 Training data size:55000。 print("Training data size: {}".format(mnist.train.num_examples)) # 打印Validating data size:5000 print(\'Validating data size: {}\'.format(mnist.validation.num_examples)) # 打印Testing data size:10000 print(\'Testing data size: {}\'.format(mnist.test.num_examples)) # 打印Example training data: print(\'Example training data: {}\'.format(mnist.train.images[0])) # 打印Example training data label: print(\'Example training data label: {}\'.format(mnist.train.labels[0])) batch_size=100 xs,ys=mnist.train.next_batch(batch_size) # 从train集合中选取batch_size个训练数据 print(\'X shape: {}\'.format(xs.shape)) # 输出:(100,784) print(\'Y shape: {}\'.format(ys.shape)) # 输出:(100,10)

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/zzxjgp.html