使用mnist中的数据,利用CNN将图片进行分类。
构建了四层的神经网络,训练需要一段时间~
convolutional layer1 + max pooling;
convolutional layer2 + max pooling;
fully connected layer1 + dropout;
fully connected layer2 to prediction.
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
mnist=input_data.read_data_sets('MNIST_data',one_hot=True)
def compulate_accuracy(v_xs,v_ys):
global prediction
y_pre = sess.run(prediction, feed_dict={xs: v_xs, keep_pro: 1<