Tensorflow机器学习入门——MINIST数据集识别
2020-02-03 05:02
1121 查看
参考网站:http://www.tensorfly.cn/tfdoc/tutorials/mnist_beginners.html
#自动下载并加载数据 from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets("MNIST_data/", one_hot=True) #构建计算图 import tensorflow as tf x = tf.placeholder("float", [None, 784]) y_ = tf.placeholder("float", [None,10]) W = tf.Variable(tf.zeros([784,10])) b = tf.Variable(tf.zeros([10])) y = tf.nn.softmax(tf.matmul(x,W) + b) cross_entropy = -tf.reduce_sum(y_*tf.log(y)) train_step = tf.train.GradientDescentOptimizer(0.01).minimize(cross_entropy) #训练1000步 init = tf.initialize_all_variables() sess = tf.Session() sess.run(init) for i in range(1000): batch_xs, batch_ys = mnist.train.next_batch(100) sess.run(train_step, feed_dict={x: batch_xs, y_: batch_ys}) #验证准确率 correct_prediction = tf.equal(tf.argmax(y,1), tf.argmax(y_,1)) accuracy = tf.reduce_mean(tf.cast(correct_prediction, "float")) print (sess.run(accuracy, feed_dict={x: mnist.test.images, y_: mnist.test.labels}))
转载于:https://www.cnblogs.com/Fengqiao/p/MINIST.html
- 点赞
- 收藏
- 分享
- 文章举报
相关文章推荐
- CNN实现手写数字识别(完整代码+minist数据集)
- 经典CNN识别MINIST数据集代码的理解
- 深度学习入门项目:用keras构建CNN或LSTM对minist数据集做简单分类任务
- 用CNN及MLP等方法识别minist数据集
- PYTORCH下RNN对MINIST数据集图片的识别
- FAIR开源目标识别平台Detectron从入门到放弃(二) 使用自己的数据集(voc2007格式)训练Detectron
- TensorFlow:实战Google深度学习框架(四)MINIST数据集识别问题
- [译]Kinect for Windows SDK开发入门(十一):手势识别 下:基本手势识别
- 用MXnet入门实战深度学习之一:安装GPU版mxnet并跑一个MNIST手写数字识别
- 基于MNIST数据集的手写数字识别应用开发实践
- 模式识别入门与贝叶斯决策理论
- 从小白开始入门python+tensorflow+cnn做人脸性别识别(一)
- 人脸和手势识别数据集 FGnet - IST-2000-26434 Face and Gesture Recognition Working group
- 区块链入门 | 惊现EOS假币!怎么来的,如何识别?
- 使用PCA + KNN对MNIST数据集进行手写数字识别 python
- RBF神经网络对iris鸢尾花数据集进行分类识别
- 深度学习Deeplearning4j入门 实战(1):Deeplearning4j 手写体数字识别
- TF:TF分类问题之MNIST手写50000数据集实现87.4%准确率识别:SGD法+softmax法+cross_entropy法—Jason niu
- opencv-人脸识别-2增加人脸数据集
- 快速入门开发实现订单类图片识别结果抽象解析