赞
踩
MINST训练的代码直接参考http://www.pianshen.com/article/3783475094/
由于显示的结果不太清晰明了,因此使用pyplot加工了下:代码如下
- #coding: utf-8
- import numpy as np
- import matplotlib.pyplot as plt
- import tensorflow as tf
- from tensorflow.examples.tutorials.mnist import input_data
-
- mnist = input_data.read_data_sets("MNIST_data", one_hot=True)
-
- input_x = tf.placeholder(tf.float32, [None, 28*28])/255
- output_y = tf.placeholder(tf.int32, [None, 10])
- input_x_images = tf.reshape(input_x, [-1, 28, 28, 1])
-
- test_x = mnist.test.images[:3000]
- test_y = mnist.test.labels[:3000]
-
- conv1 = tf.layers.conv2d(inputs=input_x_images,
- filters=32,
- kernel_size=[5, 5],
- strides=1,
- padding='same',
- activat

Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。