MNIST手写体识别入门程序整理
MNIST手写体识别入门程序整理 我自己觉得Tensorflow中文官网是个学习的好地方,mnist新手入门有详细的教程,可以把链接分享给大家。 http://www.tensorfly.cn/tfdoc/tutorials/mnist_beginners.html 由于教程里面程序是散的,鉴于有一些懒虫程序员不想自己敲代码,所以我把代码整理了一下,只要将下面的代码复制粘特到python编辑器里,直接运行就可以自动下载数据包,并将结果给出。 import tensorflow.examples.tutorials.mnist.input_data as input_data mnist = input_data.read_data_sets(“MNIST_data/”, one_hot=True) import tensorflow as tf x = tf.placeholder(“float”, [None, 784]) W = tf.Variable(tf.zeros([784,10])) b = tf.Variable(tf.zeros([10])) y = tf.nn.softmax(tf.matmul(x,W) + b) y_ = tf.placeholder(“float”, [None,10]) cross_entropy = -tf.reduce_sum(y_