1 MNIST数据集手写数字识别(简单版)
1 | import tensorflow as tf |
1 | #载入数据集 |
Extracting MNIST_data\train-images-idx3-ubyte.gz
Extracting MNIST_data\train-labels-idx1-ubyte.gz
Extracting MNIST_data\t10k-images-idx3-ubyte.gz
Extracting MNIST_data\t10k-labels-idx1-ubyte.gz
epoch:0, accuracy:0.9072
epoch:1, accuracy:0.9248
epoch:2, accuracy:0.9319
epoch:3, accuracy:0.9375
epoch:4, accuracy:0.9432
epoch:5, accuracy:0.9469
epoch:6, accuracy:0.9502
epoch:7, accuracy:0.9534
epoch:8, accuracy:0.9533
epoch:9, accuracy:0.9574
epoch:10, accuracy:0.9557
epoch:11, accuracy:0.9577
epoch:12, accuracy:0.9558
epoch:13, accuracy:0.9588
epoch:14, accuracy:0.9593
epoch:15, accuracy:0.9595
epoch:16, accuracy:0.9604
epoch:17, accuracy:0.9613
epoch:18, accuracy:0.9608
epoch:19, accuracy:0.962
总结:
1 整除 //
2 最后一层不使用激活函数,可以使用softmax
2 MNIST数据集手写数字识别(优化版)
1 | import tensorflow as tf |
1 | #载入数据集 |
Extracting MNIST_data\train-images-idx3-ubyte.gz
Extracting MNIST_data\train-labels-idx1-ubyte.gz
Extracting MNIST_data\t10k-images-idx3-ubyte.gz
Extracting MNIST_data\t10k-labels-idx1-ubyte.gz
epoch:0, accuracy:0.9192
epoch:1, accuracy:0.9496
epoch:2, accuracy:0.9543
epoch:3, accuracy:0.951
epoch:4, accuracy:0.9553
epoch:5, accuracy:0.9631
epoch:6, accuracy:0.9695
epoch:7, accuracy:0.9679
epoch:8, accuracy:0.968
epoch:9, accuracy:0.9705
epoch:10, accuracy:0.9659
epoch:11, accuracy:0.9745
epoch:12, accuracy:0.9742
epoch:13, accuracy:0.9757
epoch:14, accuracy:0.9765
epoch:15, accuracy:0.9769
epoch:16, accuracy:0.9768
epoch:17, accuracy:0.9771
epoch:18, accuracy:0.977
epoch:19, accuracy:0.9771
总结:
1 动态学习率
2 dropout
3 加1个隐层
4 使用RMSPropOptimizer优化器