用卷积神经网络进行手写数字识别
1 | import tensorflow as tf |
1 普通代码
1 | mnist = input_data.read_data_sets(PWS_DIR + "DATASET/MNIST_data", one_hot=True) |
Extracting C:/Users/lenovo/Desktop/Python WORK SPACE/DATASET/MNIST_data\train-images-idx3-ubyte.gz
Extracting C:/Users/lenovo/Desktop/Python WORK SPACE/DATASET/MNIST_data\train-labels-idx1-ubyte.gz
Extracting C:/Users/lenovo/Desktop/Python WORK SPACE/DATASET/MNIST_data\t10k-images-idx3-ubyte.gz
Extracting C:/Users/lenovo/Desktop/Python WORK SPACE/DATASET/MNIST_data\t10k-labels-idx1-ubyte.gz
Iter0, Testing Accuracy= 0.8614
Iter1, Testing Accuracy= 0.9578
Iter2, Testing Accuracy= 0.9769
Iter3, Testing Accuracy= 0.9819
Iter4, Testing Accuracy= 0.9836
Iter5, Testing Accuracy= 0.9857
2 结构化代码
1 | mnist = input_data.read_data_sets(PWS_DIR + "DATASET/MNIST_data", one_hot=True) |
Extracting C:/Users/lenovo/Desktop/Python WORK SPACE/DATASET/MNIST_data\train-images-idx3-ubyte.gz
Extracting C:/Users/lenovo/Desktop/Python WORK SPACE/DATASET/MNIST_data\train-labels-idx1-ubyte.gz
Extracting C:/Users/lenovo/Desktop/Python WORK SPACE/DATASET/MNIST_data\t10k-images-idx3-ubyte.gz
Extracting C:/Users/lenovo/Desktop/Python WORK SPACE/DATASET/MNIST_data\t10k-labels-idx1-ubyte.gz
Iter0, Testing Accuracy= 0.9401
Iter1, Testing Accuracy= 0.974
Iter2, Testing Accuracy= 0.9781
Iter3, Testing Accuracy= 0.9823
Iter4, Testing Accuracy= 0.9839
Iter5, Testing Accuracy= 0.9853