详细信息:Ubuntu 14.04(LTS),OpenCV 2.4.13,Spyder 2.3.9(Python 2.7),Tensorflow r0.10
我想用Python和Tensorflow(可选的OpenCV)从图像中识别Number .
另外,我想使用具有张量流的MNIST数据训练
像这样(代码被引用到这个页面的视频),
码:
import tensorflow as tf
import random
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
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]))
learning_rate = 0.01
training_epochs = 25
batch_size = 100
display_step = 1
### modeling ###
activation = tf.nn.softmax(tf.matmul(x, W) + b)
cross_entropy = tf.reduce_mean(-tf.reduce_sum(y * tf.log(activation), reduction_indices=1))
optimizer …Run Code Online (Sandbox Code Playgroud)