前言
本教程来自Tensorflow官方教程 tensorflow.org,网站和大部分学习资源被墙,请自主进行科学上网。文章旨在记录自己学习机器学习相关知识的过程,如对您学习过程有所助益,不胜荣幸。文章是个人翻译,水平有限,希望理解。教程采用Anaconda版本的Python,是Python3代码,编辑器是Pycharm。
原文Github地址
原文colab地址(科学上网)
环境准备
本教程将会训练一个神经网络模型使它能够将衣服图片进行分类,例如鞋子和衬衣。你并不需要完全理解教程的每一处细节。此教程将会带你快速浏览一个完整的Tensorflow 程序是如何运行的。
本教程使用了tf.keras。它是Tensorflow的一个高级API,主要用于建立和训练模型。tf.keras的发明者现在在谷歌工作,并且tf.keras已经作为了Tensorflow的官方框架。tf.keras比较有利于机器学习的初学者进行机器学习具有用户友好、模块灵活、可扩展性强的特点。
你可以使用下面Python代码导入keras模块:
# TensorFlow and tf.keras
import tensorflow as tf
from tensorflow import keras
# Helper libraries
import numpy as np
import matplotlib.pyplot as plt
print(tf.__version__)
运行Python代码结果为:
1.10.0
导入Fashion MNIST 数据集
本教程将会使用的Fashion MNIST数据集包含了70000张10个不同种类衣服的灰度图。它的每一张图片都是单独的一个衣物,并且规格是 28 x 28像素,样例如下:
Fashion MNIST和经典的MNIST一样是免费的数据集。MNIST数据集经常作为机器学习领域的“hello world”数据集提供给初学者。经典的MNIST数据集包含了60000个手写体的数字和他们对应的数字标签。样例如下:
本教程使用的是Fashion MNIST,它比MNIST数据集可能略微有一些难度,但是它和MNIST一样都是比较轻盈的数据集,有利于验证我们的算法是否如预期一样运行,是非常有利于初学者的。
我们将会使用60000张图片作为训练数据来训练神经网络,使用10000张图片作为测试数据来评估训练完成后的神经网络。现在大家可以直接使用Tensorflow的代码:
fashion_mnist = keras.datasets.fashion_mnist
(train_images, train_labels), (test_images, test_labels) = fashion_mnist.load_data()
随后开始下载(可能需要科学上网)
Downloading data from https://storage.googleapis.com/tensorflow/tf-keras-datasets/train-labels-idx1-ubyte.gz
32768/29515 [=================================] - 0s 0us/step
Downloading data from https://storage.googleapis.com/tensorflow/tf-keras-datasets/train-images-idx3-ubyte.gz
26427392/26421880 [==============================] - 1s 0us/step
Downloading data from https://storage.googleapis.com/tensorflow/tf-keras-datasets/t10k-labels-idx1-ubyte.gz
8192/5148 [===============================================] - 0s 0us/step
Downloading data from https://storage.googleapis.com/tensorflow/tf-keras-datasets/t10k-images-idx3-ubyte.gz
4423680/4422102 [==============================] - 0s 0us/step
我们加载数据集会返回NumPy arrays:
train_images和train_labels 是训练集,也就是我们的模型进行学习的数据
模型通过测试数据集进行测试也就是 test_images和test_labels
images被当作是28x28的NumPy arrays,每个像素点值在0~255之间。
labels 则是0~9的数字分类,分别是以下意义:
Label | class |
---|---|
0 | T-shirt/top |
1 | Trouser |
2 | Pullover |
3 | Dress |
4 | Coat |
5 | Sandal |
6 | Shirt |
7 | Sneaker |
8 | Bag |
9 | Ankle boot |
我们可以创建一个1x10的矩阵来保存衣服的名字:
class_names = ['T-shirt/top', 'Trouser', 'Pullover', 'Dress', 'Coat',
'Sandal', 'Shirt', 'Sneaker', 'Bag', 'Ankle boot']
查看数据
我们可以通过几行代码简单观察一下我们的初始数据:
print(train_images.shape)
(60000, 28, 28)
说明训练数据集是一个60000 x 28 x 28 的矩阵,也就是拥有60000张图片,每张图片的像素是 28 x 28
查看labels大小:
print(len(train_labels))
60000
并且每一个label都是一个0~9之间的数字
print(train_labels)
[9 0 0 ... 3 0 5]
同样的,我们可以查看测试数据,一样的,它有10000张图片,每张都是28 x 28 ,标签大小也是10000:
print(test_images.shape)
(10000, 28, 28)
print(len(test_labels))
10000
数据预处理
数据集在训练神经网络之前必须经过预处理。如果你直接打印第一张图片,你会看到一个矩阵,它里面的每一个像素的值都是0~255之间的值:
print(train_images[0])
[[ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
[ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
[ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
[ 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 13 73 0 0 1 4 0 0 0 0 1 1 0]
[ 0 0 0 0 0 0 0 0 0 0 0 0 3 0 36 136 127 62 54 0 0 0 1 3 4 0 0 3]
[ 0 0 0 0 0 0 0 0 0 0 0 0 6 0 102 204 176 134 144 123 23 0 0 0 0 12 10 0]
[ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 155 236 207 178 107 156 161 109 64 23 77 130 72 15]
[ 0 0 0 0 0 0 0 0 0 0 0 1 0 69 207 223 218 216 216 163 127 121 122 146 141 88 172 66]
[ 0 0 0 0 0 0 0 0 0 1 1 1 0 200 232 232 233 229 223 223 215 213 164 127 123 196 229 0]
[ 0 0 0 0 0 0 0 0 0 0 0 0 0 183 225 216 223 228 235 227 224 222 224 221 223 245 173 0]
[ 0 0 0 0 0 0 0 0 0 0 0 0 0 193 228 218 213 198 180 212 210 211 213 223 220 243 202 0]
[ 0 0 0 0 0 0 0 0 0 1 3 0 12 219 220 212 218 192 169 227 208 218 224 212 226 197 209 52]
[ 0 0 0 0 0 0 0 0 0 0 6 0 99 244 222 220 218 203 198 221 215 213 222 220 245 119 167 56]
[ 0 0 0 0 0 0 0 0 0 4 0 0 55 236 228 230 228 24 232 213 218 223 234 217 217 209 92 0]
[ 0 0 1 4 6 7 2 0 0 0 0 0 237 226 217 223 222 219 222 221 216 223 229 215 218 255 77 0]
[ 0 3 0 0 0 0 0 0 0 62 145 204 228 207 213 221 218 208 211 218 224 223 219 215 224 244 159 0]
[ 0 0 0 0 18 44 82 107 189 228 220 222 217 226 200 205 211 230 224 234 176 188 250 248 233 238 215 0]
[ 0 57 187 208 224 221 224 208 204 214 208 209 200 159 245 193 206 223 255 255 221 234 221 211 220 232 246 0]
[ 3 202 228 224 221 211 211 214 205 205 205 220 240 80 150 255 229 221 188 154 191 210 204 209 222 228 225 0]
[ 98 233 198 210 222 229 229 234 249 220 194 215 217 241 65 73 106 117 168 219 221 215 217 223 223 224 229 29]
[ 75 204 212 204 193 205 211 225 216 185 197 206 198 213 240 195 227 245 239 223 218 212 209 222 220 221 230 67]
[ 48 203 183 194 213 197 185 190 194 192 202 214 219 221 220 236 225 216 199 206 186 181 177 172 181 205 206 115]
[ 0 122 219 193 179 171 183 196 204 210 213 207 211 210 200 196 194 191 195 191 198 192 176 156 167 177 210 92]
[ 0 0 74 189 212 191 175 172 175 181 185 188 189 188 193 198 204 209 210 210 211 188 188 194 192 216 170 0]
[ 2 0 0 0 66 200 222 237 239 242 246 243 244 221 220 193 191 179 182 182 181 176 166 168 99 58 0 0]
[ 0 0 0 0 0 0 0 40 61 44 72 41 35 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
[ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
[ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]]
我们可以用几行绘图代码来更清楚的展示它:
plt.figure()
plt.imshow(train_images[0])
plt.colorbar()
plt.gca().grid(False)
plt.show()
我们需要把它转换成0~1之间的浮点数来投递给神经网络,为此我们可以将矩阵中的所有值除以255:
train_images = train_images / 255.0
test_images = test_images / 255.0
随后我们可以尝试展示25张图片和他们的对应的分类标签:
plt.figure(figsize=(10,10))
for i in range(25):
plt.subplot(5,5,i+1)
plt.xticks([])
plt.yticks([])
plt.grid('off')
plt.imshow(train_images[i],cmap='binary')
plt.xlabel(class_names[train_labels[I]])
plt.show()
/usr/local/lib/python3.5/dist-packages/matplotlib/cbook/deprecation.py:107: MatplotlibDeprecationWarning: Passing one of 'on', 'true', 'off', 'false' as a boolean is deprecated; use an actual boolean (True/False) instead.
warnings.warn(message, mplDeprecation, stacklevel=1)
建立模型
建立神经网络需要配置神经网络的每一层,然后编译整个模型。
建立神经层
神经网络是一个具有多层次结构的数学模型,其可以简单分为3部分,输入层、隐藏层、和输出层。输入层一般是需要学习的数据入口,数据由此进入神经网络,例如图片可以转化为矩阵输入。隐藏层可能包含多层,上图仅画出了一个,数据在隐藏层进行加工处理就像人类的感知过程一样。输出层往往是对数据的预测结果,例如输出图片中的数字是几,衣服的类型是什么。大多数深度学习的隐藏层数往往很多,神经网络中有许多参数,神经网络在不断学习过程中不断调整这些参数来使自身的预测更加精确。
Tensorflow的Keras模块可以使用极简的代码构建神经网络的模型结构:
model = keras.Sequential([
keras.layers.Flatten(input_shape=(28, 28)),
keras.layers.Dense(128, activation=tf.nn.relu),
keras.layers.Dense(10, activation=tf.nn.softmax)
])
- 该代码按照顺序构建了一个3层的神经网络模型
- 该神经网络的第一层是keras.layers.Flatten,它的作用是将输入的28 x 28 矩阵展平成一个 [1 x 784]的矩阵,也就是将图片降维,虽然这样失去了二维数据的信息的意义,但有利于神经网络数据的输入和转换。
- 神经网络的第二层是一个拥有128个神经元的全连接层,它的激活函数是relu函数。
- 神经网络的第三层是输出层,拥有10个神经元,它的激活函数是softmax函数,它将返回10个概率分数的数组,总和为1。每个节点包含一个分数,表示当前图像属于10个类别之一的概率。
编译模型
在开始训练之前,需要进一步的进行设置,这些设置是在模型的编译步骤进行的:
- 损失函数(Loss function) - 这可以衡量模型在训练过程中的准确程度。我们希望最小化此这个函数值,以便在正确的方向上“引导”模型。
- 优化器 (Optimizer)- 它会根据你采用的不同种类的智能优化算法,来不断的求解损失函数的最小值。最常见的是梯度下降法,框架提供了很多种不同的优化器,需要根据问题尝试最佳的优化器
- 性能评估(Metrics) - 用于监控培训和测试步骤。以下示例使用精度,即正确分类的图像分数。
model.compile(optimizer=tf.train.AdamOptimizer(),
loss='sparse_categorical_crossentropy',
metrics=['accuracy'])
- AdamOptimizer优化器通过使用动量(参数的移动平均数)来改善传统梯度下降,促进超参数动态调整。
- sparse_categorical_crossentropy 是多类对数损失函数
训练模型
训练神经网络需要以下步骤:
1.将训练数据投递给神经网络,也就是train_images和train_labels矩阵
2.神经网络学习,将标签和图片关联起来
3.将测试数据test_imges投递给神经网络,神经网络给出预测值。我们可以将神经网络的输出结果和test_labels进行比对来验证预测值是否正确。
我们可以运用一行代码就可以开始神经网络的训练:
model.fit(train_images, train_labels, epochs=5)
Epoch 1/5
2018-08-15 14:32:47.708255: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA
2018-08-15 14:32:47.711370: I tensorflow/core/common_runtime/process_util.cc:69] Creating new thread pool with default inter op setting: 4. Tune using inter_op_parallelism_threads for best performance.
32/60000 [..............................] - ETA: 19:56 - loss: 2.6159 - acc: 0.1250
416/60000 [..............................] - ETA: 1:39 - loss: 1.8184 - acc: 0.4111
800/60000 [..............................] - ETA: 54s - loss: 1.4742 - acc: 0.5350
1216/60000 [..............................] - ETA: 38s - loss: 1.2824 - acc: 0.5765
1568/60000 [..............................] - ETA: 31s - loss: 1.1770 - acc: 0.6059
1952/60000 [..............................] - ETA: 26s - loss: 1.0918 - acc: 0.6404
2368/60000 [>.............................] - ETA: 23s - loss: 1.0141 - acc: 0.6660
2784/60000 [>.............................] - ETA: 20s - loss: 0.9684 - acc: 0.6785
3200/60000 [>.............................] - ETA: 18s - loss: 0.9318 - acc: 0.6897
3552/60000 [>.............................] - ETA: 17s - loss: 0.9068 - acc: 0.6990
3936/60000 [>.............................] - ETA: 16s - loss: 0.8817 - acc: 0.7068
4384/60000 [=>............................] - ETA: 15s - loss: 0.8512 - acc: 0.7144
4864/60000 [=>............................] - ETA: 14s - loss: 0.8361 - acc: 0.7183
5216/60000 [=>............................] - ETA: 13s - loss: 0.8262 - acc: 0.7222
5600/60000 [=>............................] - ETA: 13s - loss: 0.8136 - acc: 0.7255
6080/60000 [==>...........................] - ETA: 12s - loss: 0.7901 - acc: 0.7332
6560/60000 [==>...........................] - ETA: 12s - loss: 0.7725 - acc: 0.7380
6976/60000 [==>...........................] - ETA: 11s - loss: 0.7596 - acc: 0.7415
7360/60000 [==>...........................] - ETA: 11s - loss: 0.7507 - acc: 0.7455
7744/60000 [==>...........................] - ETA: 11s - loss: 0.7386 - acc: 0.7491
8160/60000 [===>..........................] - ETA: 10s - loss: 0.7287 - acc: 0.7523
8512/60000 [===>..........................] - ETA: 10s - loss: 0.7182 - acc: 0.7565
8896/60000 [===>..........................] - ETA: 10s - loss: 0.7110 - acc: 0.7600
9216/60000 [===>..........................] - ETA: 10s - loss: 0.7030 - acc: 0.7624
9632/60000 [===>..........................] - ETA: 9s - loss: 0.6937 - acc: 0.7650
9952/60000 [===>..........................] - ETA: 9s - loss: 0.6887 - acc: 0.7667
10304/60000 [====>.........................] - ETA: 9s - loss: 0.6839 - acc: 0.7686
10656/60000 [====>.........................] - ETA: 9s - loss: 0.6784 - acc: 0.7706
10976/60000 [====>.........................] - ETA: 9s - loss: 0.6726 - acc: 0.7728
11296/60000 [====>.........................] - ETA: 9s - loss: 0.6700 - acc: 0.7742
11712/60000 [====>.........................] - ETA: 9s - loss: 0.6672 - acc: 0.7748
12160/60000 [=====>........................] - ETA: 8s - loss: 0.6650 - acc: 0.7759
12576/60000 [=====>........................] - ETA: 8s - loss: 0.6615 - acc: 0.7767
12864/60000 [=====>........................] - ETA: 8s - loss: 0.6584 - acc: 0.7778
13248/60000 [=====>........................] - ETA: 8s - loss: 0.6592 - acc: 0.7774
13664/60000 [=====>........................] - ETA: 8s - loss: 0.6571 - acc: 0.7780
14112/60000 [======>.......................] - ETA: 8s - loss: 0.6522 - acc: 0.7795
14560/60000 [======>.......................] - ETA: 8s - loss: 0.6475 - acc: 0.7804
14976/60000 [======>.......................] - ETA: 7s - loss: 0.6434 - acc: 0.7813
15456/60000 [======>.......................] - ETA: 7s - loss: 0.6399 - acc: 0.7829
15936/60000 [======>.......................] - ETA: 7s - loss: 0.6371 - acc: 0.7838
16320/60000 [=======>......................] - ETA: 7s - loss: 0.6338 - acc: 0.7853
16704/60000 [=======>......................] - ETA: 7s - loss: 0.6313 - acc: 0.7860
17152/60000 [=======>......................] - ETA: 7s - loss: 0.6291 - acc: 0.7873
17632/60000 [=======>......................] - ETA: 7s - loss: 0.6268 - acc: 0.7878
18080/60000 [========>.....................] - ETA: 6s - loss: 0.6259 - acc: 0.7878
18528/60000 [========>.....................] - ETA: 6s - loss: 0.6223 - acc: 0.7890
19008/60000 [========>.....................] - ETA: 6s - loss: 0.6200 - acc: 0.7902
19456/60000 [========>.....................] - ETA: 6s - loss: 0.6179 - acc: 0.7910
19872/60000 [========>.....................] - ETA: 6s - loss: 0.6153 - acc: 0.7916
20320/60000 [=========>....................] - ETA: 6s - loss: 0.6148 - acc: 0.7919
20800/60000 [=========>....................] - ETA: 6s - loss: 0.6120 - acc: 0.7924
21216/60000 [=========>....................] - ETA: 6s - loss: 0.6093 - acc: 0.7932
21632/60000 [=========>....................] - ETA: 6s - loss: 0.6068 - acc: 0.7939
22080/60000 [==========>...................] - ETA: 5s - loss: 0.6038 - acc: 0.7948
22560/60000 [==========>...................] - ETA: 5s - loss: 0.5994 - acc: 0.7964
23040/60000 [==========>...................] - ETA: 5s - loss: 0.5968 - acc: 0.7973
23392/60000 [==========>...................] - ETA: 5s - loss: 0.5946 - acc: 0.7979
23808/60000 [==========>...................] - ETA: 5s - loss: 0.5932 - acc: 0.7983
24288/60000 [===========>..................] - ETA: 5s - loss: 0.5905 - acc: 0.7992
24768/60000 [===========>..................] - ETA: 5s - loss: 0.5879 - acc: 0.7999
25120/60000 [===========>..................] - ETA: 5s - loss: 0.5867 - acc: 0.8007
25536/60000 [===========>..................] - ETA: 5s - loss: 0.5845 - acc: 0.8011
26016/60000 [============>.................] - ETA: 5s - loss: 0.5816 - acc: 0.8020
26496/60000 [============>.................] - ETA: 5s - loss: 0.5808 - acc: 0.8022
26848/60000 [============>.................] - ETA: 4s - loss: 0.5795 - acc: 0.8023
27168/60000 [============>.................] - ETA: 4s - loss: 0.5786 - acc: 0.8026
27520/60000 [============>.................] - ETA: 4s - loss: 0.5764 - acc: 0.8033
28000/60000 [=============>................] - ETA: 4s - loss: 0.5764 - acc: 0.8030
28416/60000 [=============>................] - ETA: 4s - loss: 0.5744 - acc: 0.8035
28864/60000 [=============>................] - ETA: 4s - loss: 0.5729 - acc: 0.8040
29248/60000 [=============>................] - ETA: 4s - loss: 0.5713 - acc: 0.8046
29696/60000 [=============>................] - ETA: 4s - loss: 0.5697 - acc: 0.8050
30112/60000 [==============>...............] - ETA: 4s - loss: 0.5684 - acc: 0.8053
30560/60000 [==============>...............] - ETA: 4s - loss: 0.5667 - acc: 0.8059
31040/60000 [==============>...............] - ETA: 4s - loss: 0.5641 - acc: 0.8068
31488/60000 [==============>...............] - ETA: 4s - loss: 0.5625 - acc: 0.8072
31840/60000 [==============>...............] - ETA: 4s - loss: 0.5612 - acc: 0.8078
32192/60000 [===============>..............] - ETA: 4s - loss: 0.5602 - acc: 0.8082
32608/60000 [===============>..............] - ETA: 4s - loss: 0.5591 - acc: 0.8085
33056/60000 [===============>..............] - ETA: 3s - loss: 0.5579 - acc: 0.8089
33408/60000 [===============>..............] - ETA: 3s - loss: 0.5568 - acc: 0.8092
33824/60000 [===============>..............] - ETA: 3s - loss: 0.5548 - acc: 0.8097
34304/60000 [================>.............] - ETA: 3s - loss: 0.5534 - acc: 0.8100
34784/60000 [================>.............] - ETA: 3s - loss: 0.5512 - acc: 0.8106
35136/60000 [================>.............] - ETA: 3s - loss: 0.5500 - acc: 0.8110
35552/60000 [================>.............] - ETA: 3s - loss: 0.5486 - acc: 0.8114
36032/60000 [=================>............] - ETA: 3s - loss: 0.5464 - acc: 0.8122
36480/60000 [=================>............] - ETA: 3s - loss: 0.5461 - acc: 0.8122
36864/60000 [=================>............] - ETA: 3s - loss: 0.5455 - acc: 0.8124
37184/60000 [=================>............] - ETA: 3s - loss: 0.5448 - acc: 0.8126
37600/60000 [=================>............] - ETA: 3s - loss: 0.5441 - acc: 0.8130
38048/60000 [==================>...........] - ETA: 3s - loss: 0.5426 - acc: 0.8134
38432/60000 [==================>...........] - ETA: 3s - loss: 0.5418 - acc: 0.8136
38880/60000 [==================>...........] - ETA: 3s - loss: 0.5405 - acc: 0.8139
39328/60000 [==================>...........] - ETA: 2s - loss: 0.5394 - acc: 0.8140
39808/60000 [==================>...........] - ETA: 2s - loss: 0.5389 - acc: 0.8142
40192/60000 [===================>..........] - ETA: 2s - loss: 0.5376 - acc: 0.8145
40640/60000 [===================>..........] - ETA: 2s - loss: 0.5363 - acc: 0.8150
41120/60000 [===================>..........] - ETA: 2s - loss: 0.5352 - acc: 0.8155
41504/60000 [===================>..........] - ETA: 2s - loss: 0.5337 - acc: 0.8159
41888/60000 [===================>..........] - ETA: 2s - loss: 0.5326 - acc: 0.8162
42304/60000 [====================>.........] - ETA: 2s - loss: 0.5313 - acc: 0.8168
42784/60000 [====================>.........] - ETA: 2s - loss: 0.5301 - acc: 0.8172
43264/60000 [====================>.........] - ETA: 2s - loss: 0.5288 - acc: 0.8176
43520/60000 [====================>.........] - ETA: 2s - loss: 0.5287 - acc: 0.8177
43840/60000 [====================>.........] - ETA: 2s - loss: 0.5281 - acc: 0.8180
44192/60000 [=====================>........] - ETA: 2s - loss: 0.5277 - acc: 0.8182
44576/60000 [=====================>........] - ETA: 2s - loss: 0.5264 - acc: 0.8186
44896/60000 [=====================>........] - ETA: 2s - loss: 0.5259 - acc: 0.8189
45344/60000 [=====================>........] - ETA: 2s - loss: 0.5250 - acc: 0.8193
45824/60000 [=====================>........] - ETA: 1s - loss: 0.5239 - acc: 0.8197
46272/60000 [======================>.......] - ETA: 1s - loss: 0.5233 - acc: 0.8199
46656/60000 [======================>.......] - ETA: 1s - loss: 0.5221 - acc: 0.8202
47072/60000 [======================>.......] - ETA: 1s - loss: 0.5213 - acc: 0.8206
47456/60000 [======================>.......] - ETA: 1s - loss: 0.5208 - acc: 0.8207
47872/60000 [======================>.......] - ETA: 1s - loss: 0.5202 - acc: 0.8207
48224/60000 [=======================>......] - ETA: 1s - loss: 0.5198 - acc: 0.8208
48608/60000 [=======================>......] - ETA: 1s - loss: 0.5189 - acc: 0.8209
48992/60000 [=======================>......] - ETA: 1s - loss: 0.5181 - acc: 0.8211
49440/60000 [=======================>......] - ETA: 1s - loss: 0.5174 - acc: 0.8211
49824/60000 [=======================>......] - ETA: 1s - loss: 0.5169 - acc: 0.8211
50272/60000 [========================>.....] - ETA: 1s - loss: 0.5155 - acc: 0.8216
50720/60000 [========================>.....] - ETA: 1s - loss: 0.5141 - acc: 0.8222
51168/60000 [========================>.....] - ETA: 1s - loss: 0.5127 - acc: 0.8225
51584/60000 [========================>.....] - ETA: 1s - loss: 0.5122 - acc: 0.8226
51968/60000 [========================>.....] - ETA: 1s - loss: 0.5116 - acc: 0.8229
52416/60000 [=========================>....] - ETA: 1s - loss: 0.5110 - acc: 0.8232
52864/60000 [=========================>....] - ETA: 0s - loss: 0.5101 - acc: 0.8234
53120/60000 [=========================>....] - ETA: 0s - loss: 0.5097 - acc: 0.8235
53440/60000 [=========================>....] - ETA: 0s - loss: 0.5092 - acc: 0.8236
53760/60000 [=========================>....] - ETA: 0s - loss: 0.5092 - acc: 0.8235
54080/60000 [==========================>...] - ETA: 0s - loss: 0.5085 - acc: 0.8237
54400/60000 [==========================>...] - ETA: 0s - loss: 0.5075 - acc: 0.8241
54688/60000 [==========================>...] - ETA: 0s - loss: 0.5066 - acc: 0.8242
55040/60000 [==========================>...] - ETA: 0s - loss: 0.5060 - acc: 0.8244
55488/60000 [==========================>...] - ETA: 0s - loss: 0.5053 - acc: 0.8245
55968/60000 [==========================>...] - ETA: 0s - loss: 0.5047 - acc: 0.8246
56288/60000 [===========================>..] - ETA: 0s - loss: 0.5036 - acc: 0.8249
56672/60000 [===========================>..] - ETA: 0s - loss: 0.5031 - acc: 0.8251
57152/60000 [===========================>..] - ETA: 0s - loss: 0.5024 - acc: 0.8253
57600/60000 [===========================>..] - ETA: 0s - loss: 0.5014 - acc: 0.8256
57952/60000 [===========================>..] - ETA: 0s - loss: 0.5010 - acc: 0.8257
58304/60000 [============================>.] - ETA: 0s - loss: 0.5008 - acc: 0.8258
58752/60000 [============================>.] - ETA: 0s - loss: 0.5004 - acc: 0.8259
59168/60000 [============================>.] - ETA: 0s - loss: 0.4999 - acc: 0.8260
59552/60000 [============================>.] - ETA: 0s - loss: 0.4989 - acc: 0.8263
59968/60000 [============================>.] - ETA: 0s - loss: 0.4992 - acc: 0.8263
60000/60000 [==============================] - 8s 139us/step - loss: 0.4994 - acc: 0.8263
Epoch 2/5
32/60000 [..............................] - ETA: 10s - loss: 0.3665 - acc: 0.9062
416/60000 [..............................] - ETA: 8s - loss: 0.3400 - acc: 0.8942
864/60000 [..............................] - ETA: 7s - loss: 0.3748 - acc: 0.8669
1216/60000 [..............................] - ETA: 7s - loss: 0.3931 - acc: 0.8643
1632/60000 [..............................] - ETA: 7s - loss: 0.3992 - acc: 0.8621
2080/60000 [>.............................] - ETA: 7s - loss: 0.3984 - acc: 0.8596
2528/60000 [>.............................] - ETA: 7s - loss: 0.4009 - acc: 0.8600
2976/60000 [>.............................] - ETA: 7s - loss: 0.3920 - acc: 0.8629
3424/60000 [>.............................] - ETA: 7s - loss: 0.3854 - acc: 0.8645
3904/60000 [>.............................] - ETA: 6s - loss: 0.3798 - acc: 0.8668
4320/60000 [=>............................] - ETA: 6s - loss: 0.3799 - acc: 0.8657
4736/60000 [=>............................] - ETA: 6s - loss: 0.3779 - acc: 0.8678
5184/60000 [=>............................] - ETA: 6s - loss: 0.3766 - acc: 0.8679
5664/60000 [=>............................] - ETA: 6s - loss: 0.3721 - acc: 0.8676
6144/60000 [==>...........................] - ETA: 6s - loss: 0.3746 - acc: 0.8665
6528/60000 [==>...........................] - ETA: 6s - loss: 0.3812 - acc: 0.8655
6944/60000 [==>...........................] - ETA: 6s - loss: 0.3820 - acc: 0.8648
7424/60000 [==>...........................] - ETA: 6s - loss: 0.3818 - acc: 0.8660
7872/60000 [==>...........................] - ETA: 6s - loss: 0.3831 - acc: 0.8646
8288/60000 [===>..........................] - ETA: 6s - loss: 0.3831 - acc: 0.8643
8704/60000 [===>..........................] - ETA: 6s - loss: 0.3838 - acc: 0.8629
9184/60000 [===>..........................] - ETA: 6s - loss: 0.3804 - acc: 0.8652
9664/60000 [===>..........................] - ETA: 6s - loss: 0.3804 - acc: 0.8650
10080/60000 [====>.........................] - ETA: 5s - loss: 0.3812 - acc: 0.8644
10528/60000 [====>.........................] - ETA: 5s - loss: 0.3838 - acc: 0.8633
10976/60000 [====>.........................] - ETA: 5s - loss: 0.3866 - acc: 0.8615
11424/60000 [====>.........................] - ETA: 5s - loss: 0.3869 - acc: 0.8613
11808/60000 [====>.........................] - ETA: 5s - loss: 0.3856 - acc: 0.8616
12256/60000 [=====>........................] - ETA: 5s - loss: 0.3838 - acc: 0.8623
12736/60000 [=====>........................] - ETA: 5s - loss: 0.3846 - acc: 0.8624
13152/60000 [=====>........................] - ETA: 5s - loss: 0.3846 - acc: 0.8623
13472/60000 [=====>........................] - ETA: 5s - loss: 0.3838 - acc: 0.8620
13856/60000 [=====>........................] - ETA: 5s - loss: 0.3846 - acc: 0.8614
14304/60000 [======>.......................] - ETA: 5s - loss: 0.3855 - acc: 0.8616
14752/60000 [======>.......................] - ETA: 5s - loss: 0.3866 - acc: 0.8610
15072/60000 [======>.......................] - ETA: 5s - loss: 0.3867 - acc: 0.8609
15392/60000 [======>.......................] - ETA: 5s - loss: 0.3873 - acc: 0.8605
15776/60000 [======>.......................] - ETA: 5s - loss: 0.3867 - acc: 0.8605
16224/60000 [=======>......................] - ETA: 5s - loss: 0.3871 - acc: 0.8606
16544/60000 [=======>......................] - ETA: 5s - loss: 0.3880 - acc: 0.8608
16960/60000 [=======>......................] - ETA: 5s - loss: 0.3877 - acc: 0.8607
17440/60000 [=======>......................] - ETA: 5s - loss: 0.3861 - acc: 0.8611
17888/60000 [=======>......................] - ETA: 5s - loss: 0.3855 - acc: 0.8613
18272/60000 [========>.....................] - ETA: 5s - loss: 0.3867 - acc: 0.8604
18688/60000 [========>.....................] - ETA: 5s - loss: 0.3876 - acc: 0.8600
19168/60000 [========>.....................] - ETA: 5s - loss: 0.3876 - acc: 0.8599
19648/60000 [========>.....................] - ETA: 4s - loss: 0.3874 - acc: 0.8598
20032/60000 [=========>....................] - ETA: 4s - loss: 0.3862 - acc: 0.8603
20416/60000 [=========>....................] - ETA: 4s - loss: 0.3857 - acc: 0.8605
20704/60000 [=========>....................] - ETA: 4s - loss: 0.3875 - acc: 0.8604
21024/60000 [=========>....................] - ETA: 4s - loss: 0.3883 - acc: 0.8599
21344/60000 [=========>....................] - ETA: 4s - loss: 0.3872 - acc: 0.8602
21696/60000 [=========>....................] - ETA: 4s - loss: 0.3870 - acc: 0.8604
22080/60000 [==========>...................] - ETA: 4s - loss: 0.3865 - acc: 0.8606
22496/60000 [==========>...................] - ETA: 4s - loss: 0.3871 - acc: 0.8602
22880/60000 [==========>...................] - ETA: 4s - loss: 0.3869 - acc: 0.8605
23296/60000 [==========>...................] - ETA: 4s - loss: 0.3861 - acc: 0.8608
23776/60000 [==========>...................] - ETA: 4s - loss: 0.3849 - acc: 0.8613
24224/60000 [===========>..................] - ETA: 4s - loss: 0.3846 - acc: 0.8615
24512/60000 [===========>..................] - ETA: 4s - loss: 0.3843 - acc: 0.8615
24864/60000 [===========>..................] - ETA: 4s - loss: 0.3843 - acc: 0.8611
25248/60000 [===========>..................] - ETA: 4s - loss: 0.3842 - acc: 0.8610
25600/60000 [===========>..................] - ETA: 4s - loss: 0.3827 - acc: 0.8615
25920/60000 [===========>..................] - ETA: 4s - loss: 0.3839 - acc: 0.8614
26176/60000 [============>.................] - ETA: 4s - loss: 0.3844 - acc: 0.8614
26528/60000 [============>.................] - ETA: 4s - loss: 0.3840 - acc: 0.8618
26848/60000 [============>.................] - ETA: 4s - loss: 0.3838 - acc: 0.8619
27104/60000 [============>.................] - ETA: 4s - loss: 0.3837 - acc: 0.8618
27328/60000 [============>.................] - ETA: 4s - loss: 0.3836 - acc: 0.8618
27648/60000 [============>.................] - ETA: 4s - loss: 0.3829 - acc: 0.8619
27968/60000 [============>.................] - ETA: 4s - loss: 0.3826 - acc: 0.8619
28256/60000 [=============>................] - ETA: 4s - loss: 0.3824 - acc: 0.8620
28544/60000 [=============>................] - ETA: 4s - loss: 0.3821 - acc: 0.8622
28864/60000 [=============>................] - ETA: 4s - loss: 0.3811 - acc: 0.8626
29184/60000 [=============>................] - ETA: 4s - loss: 0.3811 - acc: 0.8627
29472/60000 [=============>................] - ETA: 4s - loss: 0.3812 - acc: 0.8627
29760/60000 [=============>................] - ETA: 4s - loss: 0.3808 - acc: 0.8627
30080/60000 [==============>...............] - ETA: 4s - loss: 0.3807 - acc: 0.8630
30400/60000 [==============>...............] - ETA: 3s - loss: 0.3800 - acc: 0.8633
30752/60000 [==============>...............] - ETA: 3s - loss: 0.3807 - acc: 0.8631
31136/60000 [==============>...............] - ETA: 3s - loss: 0.3811 - acc: 0.8626
31552/60000 [==============>...............] - ETA: 3s - loss: 0.3809 - acc: 0.8627
31904/60000 [==============>...............] - ETA: 3s - loss: 0.3813 - acc: 0.8627
32256/60000 [===============>..............] - ETA: 3s - loss: 0.3822 - acc: 0.8624
32704/60000 [===============>..............] - ETA: 3s - loss: 0.3818 - acc: 0.8626
33152/60000 [===============>..............] - ETA: 3s - loss: 0.3816 - acc: 0.8626
33568/60000 [===============>..............] - ETA: 3s - loss: 0.3815 - acc: 0.8626
33952/60000 [===============>..............] - ETA: 3s - loss: 0.3819 - acc: 0.8627
34368/60000 [================>.............] - ETA: 3s - loss: 0.3818 - acc: 0.8627
34752/60000 [================>.............] - ETA: 3s - loss: 0.3817 - acc: 0.8626
35168/60000 [================>.............] - ETA: 3s - loss: 0.3817 - acc: 0.8626
35584/60000 [================>.............] - ETA: 3s - loss: 0.3811 - acc: 0.8627
36000/60000 [=================>............] - ETA: 3s - loss: 0.3802 - acc: 0.8630
36480/60000 [=================>............] - ETA: 3s - loss: 0.3802 - acc: 0.8633
36960/60000 [=================>............] - ETA: 3s - loss: 0.3809 - acc: 0.8630
37408/60000 [=================>............] - ETA: 3s - loss: 0.3817 - acc: 0.8628
37856/60000 [=================>............] - ETA: 2s - loss: 0.3828 - acc: 0.8626
38272/60000 [==================>...........] - ETA: 2s - loss: 0.3827 - acc: 0.8626
38688/60000 [==================>...........] - ETA: 2s - loss: 0.3820 - acc: 0.8626
38944/60000 [==================>...........] - ETA: 2s - loss: 0.3826 - acc: 0.8626
39232/60000 [==================>...........] - ETA: 2s - loss: 0.3822 - acc: 0.8627
39616/60000 [==================>...........] - ETA: 2s - loss: 0.3827 - acc: 0.8627
40000/60000 [===================>..........] - ETA: 2s - loss: 0.3819 - acc: 0.8630
40352/60000 [===================>..........] - ETA: 2s - loss: 0.3819 - acc: 0.8630
40736/60000 [===================>..........] - ETA: 2s - loss: 0.3811 - acc: 0.8634
41088/60000 [===================>..........] - ETA: 2s - loss: 0.3812 - acc: 0.8634
41376/60000 [===================>..........] - ETA: 2s - loss: 0.3817 - acc: 0.8633
41632/60000 [===================>..........] - ETA: 2s - loss: 0.3820 - acc: 0.8631
42048/60000 [====================>.........] - ETA: 2s - loss: 0.3814 - acc: 0.8634
42528/60000 [====================>.........] - ETA: 2s - loss: 0.3805 - acc: 0.8638
43008/60000 [====================>.........] - ETA: 2s - loss: 0.3799 - acc: 0.8641
43424/60000 [====================>.........] - ETA: 2s - loss: 0.3791 - acc: 0.8642
43872/60000 [====================>.........] - ETA: 2s - loss: 0.3785 - acc: 0.8644
44352/60000 [=====================>........] - ETA: 2s - loss: 0.3791 - acc: 0.8641
44832/60000 [=====================>........] - ETA: 2s - loss: 0.3789 - acc: 0.8641
45248/60000 [=====================>........] - ETA: 1s - loss: 0.3790 - acc: 0.8640
45632/60000 [=====================>........] - ETA: 1s - loss: 0.3791 - acc: 0.8638
46112/60000 [======================>.......] - ETA: 1s - loss: 0.3789 - acc: 0.8638
46592/60000 [======================>.......] - ETA: 1s - loss: 0.3783 - acc: 0.8641
47008/60000 [======================>.......] - ETA: 1s - loss: 0.3783 - acc: 0.8640
47424/60000 [======================>.......] - ETA: 1s - loss: 0.3777 - acc: 0.8643
47904/60000 [======================>.......] - ETA: 1s - loss: 0.3778 - acc: 0.8642
48384/60000 [=======================>......] - ETA: 1s - loss: 0.3774 - acc: 0.8644
48800/60000 [=======================>......] - ETA: 1s - loss: 0.3772 - acc: 0.8645
49248/60000 [=======================>......] - ETA: 1s - loss: 0.3769 - acc: 0.8646
49728/60000 [=======================>......] - ETA: 1s - loss: 0.3766 - acc: 0.8646
50144/60000 [========================>.....] - ETA: 1s - loss: 0.3760 - acc: 0.8649
50560/60000 [========================>.....] - ETA: 1s - loss: 0.3760 - acc: 0.8648
51008/60000 [========================>.....] - ETA: 1s - loss: 0.3762 - acc: 0.8647
51424/60000 [========================>.....] - ETA: 1s - loss: 0.3758 - acc: 0.8648
51776/60000 [========================>.....] - ETA: 1s - loss: 0.3763 - acc: 0.8647
52064/60000 [=========================>....] - ETA: 1s - loss: 0.3760 - acc: 0.8650
52352/60000 [=========================>....] - ETA: 1s - loss: 0.3759 - acc: 0.8649
52768/60000 [=========================>....] - ETA: 0s - loss: 0.3760 - acc: 0.8649
53248/60000 [=========================>....] - ETA: 0s - loss: 0.3755 - acc: 0.8650
53696/60000 [=========================>....] - ETA: 0s - loss: 0.3757 - acc: 0.8650
53984/60000 [=========================>....] - ETA: 0s - loss: 0.3760 - acc: 0.8648
54368/60000 [==========================>...] - ETA: 0s - loss: 0.3766 - acc: 0.8646
54752/60000 [==========================>...] - ETA: 0s - loss: 0.3770 - acc: 0.8644
55200/60000 [==========================>...] - ETA: 0s - loss: 0.3765 - acc: 0.8645
55648/60000 [==========================>...] - ETA: 0s - loss: 0.3760 - acc: 0.8647
55968/60000 [==========================>...] - ETA: 0s - loss: 0.3763 - acc: 0.8647
56288/60000 [===========================>..] - ETA: 0s - loss: 0.3762 - acc: 0.8646
56576/60000 [===========================>..] - ETA: 0s - loss: 0.3763 - acc: 0.8645
56928/60000 [===========================>..] - ETA: 0s - loss: 0.3761 - acc: 0.8647
57248/60000 [===========================>..] - ETA: 0s - loss: 0.3758 - acc: 0.8648
57568/60000 [===========================>..] - ETA: 0s - loss: 0.3756 - acc: 0.8648
57920/60000 [===========================>..] - ETA: 0s - loss: 0.3755 - acc: 0.8648
58304/60000 [============================>.] - ETA: 0s - loss: 0.3760 - acc: 0.8646
58624/60000 [============================>.] - ETA: 0s - loss: 0.3761 - acc: 0.8646
59040/60000 [============================>.] - ETA: 0s - loss: 0.3759 - acc: 0.8648
59520/60000 [============================>.] - ETA: 0s - loss: 0.3753 - acc: 0.8650
60000/60000 [==============================] - 8s 132us/step - loss: 0.3750 - acc: 0.8649
Epoch 3/5
32/60000 [..............................] - ETA: 11s - loss: 0.2271 - acc: 0.9062
352/60000 [..............................] - ETA: 9s - loss: 0.3394 - acc: 0.8722
704/60000 [..............................] - ETA: 9s - loss: 0.3463 - acc: 0.8778
1024/60000 [..............................] - ETA: 9s - loss: 0.3761 - acc: 0.8711
1408/60000 [..............................] - ETA: 8s - loss: 0.3633 - acc: 0.8707
1728/60000 [..............................] - ETA: 8s - loss: 0.3629 - acc: 0.8721
2016/60000 [>.............................] - ETA: 9s - loss: 0.3503 - acc: 0.8770
2304/60000 [>.............................] - ETA: 9s - loss: 0.3443 - acc: 0.8798
2624/60000 [>.............................] - ETA: 9s - loss: 0.3391 - acc: 0.8822
2912/60000 [>.............................] - ETA: 9s - loss: 0.3397 - acc: 0.8802
3232/60000 [>.............................] - ETA: 9s - loss: 0.3374 - acc: 0.8815
3584/60000 [>.............................] - ETA: 9s - loss: 0.3427 - acc: 0.8800
3936/60000 [>.............................] - ETA: 9s - loss: 0.3395 - acc: 0.8793
4320/60000 [=>............................] - ETA: 8s - loss: 0.3434 - acc: 0.8803
4704/60000 [=>............................] - ETA: 8s - loss: 0.3446 - acc: 0.8778
5184/60000 [=>............................] - ETA: 8s - loss: 0.3405 - acc: 0.8783
5600/60000 [=>............................] - ETA: 8s - loss: 0.3404 - acc: 0.8788
5888/60000 [=>............................] - ETA: 8s - loss: 0.3412 - acc: 0.8777
6176/60000 [==>...........................] - ETA: 8s - loss: 0.3398 - acc: 0.8786
6496/60000 [==>...........................] - ETA: 8s - loss: 0.3404 - acc: 0.8782
6848/60000 [==>...........................] - ETA: 8s - loss: 0.3395 - acc: 0.8782
7200/60000 [==>...........................] - ETA: 8s - loss: 0.3365 - acc: 0.8789
7552/60000 [==>...........................] - ETA: 8s - loss: 0.3370 - acc: 0.8792
8000/60000 [===>..........................] - ETA: 7s - loss: 0.3342 - acc: 0.8806
8320/60000 [===>..........................] - ETA: 7s - loss: 0.3334 - acc: 0.8804
8576/60000 [===>..........................] - ETA: 7s - loss: 0.3336 - acc: 0.8805
8832/60000 [===>..........................] - ETA: 7s - loss: 0.3327 - acc: 0.8807
9088/60000 [===>..........................] - ETA: 8s - loss: 0.3348 - acc: 0.8794
9408/60000 [===>..........................] - ETA: 7s - loss: 0.3341 - acc: 0.8802
9792/60000 [===>..........................] - ETA: 7s - loss: 0.3335 - acc: 0.8806
10176/60000 [====>.........................] - ETA: 7s - loss: 0.3317 - acc: 0.8812
10496/60000 [====>.........................] - ETA: 7s - loss: 0.3306 - acc: 0.8816
10880/60000 [====>.........................] - ETA: 7s - loss: 0.3292 - acc: 0.8822
11232/60000 [====>.........................] - ETA: 7s - loss: 0.3314 - acc: 0.8818
11520/60000 [====>.........................] - ETA: 7s - loss: 0.3315 - acc: 0.8818
11808/60000 [====>.........................] - ETA: 7s - loss: 0.3336 - acc: 0.8812
12192/60000 [=====>........................] - ETA: 7s - loss: 0.3330 - acc: 0.8812
12640/60000 [=====>........................] - ETA: 7s - loss: 0.3347 - acc: 0.8809
12960/60000 [=====>........................] - ETA: 7s - loss: 0.3343 - acc: 0.8810
13280/60000 [=====>........................] - ETA: 7s - loss: 0.3340 - acc: 0.8809
13728/60000 [=====>........................] - ETA: 7s - loss: 0.3346 - acc: 0.8808
14144/60000 [======>.......................] - ETA: 7s - loss: 0.3363 - acc: 0.8804
14496/60000 [======>.......................] - ETA: 6s - loss: 0.3371 - acc: 0.8798
14848/60000 [======>.......................] - ETA: 6s - loss: 0.3374 - acc: 0.8798
15232/60000 [======>.......................] - ETA: 6s - loss: 0.3383 - acc: 0.8801
15616/60000 [======>.......................] - ETA: 6s - loss: 0.3390 - acc: 0.8796
15968/60000 [======>.......................] - ETA: 6s - loss: 0.3407 - acc: 0.8787
16384/60000 [=======>......................] - ETA: 6s - loss: 0.3400 - acc: 0.8790
16864/60000 [=======>......................] - ETA: 6s - loss: 0.3395 - acc: 0.8791
17312/60000 [=======>......................] - ETA: 6s - loss: 0.3404 - acc: 0.8786
17696/60000 [=======>......................] - ETA: 6s - loss: 0.3404 - acc: 0.8784
18048/60000 [========>.....................] - ETA: 6s - loss: 0.3402 - acc: 0.8785
18464/60000 [========>.....................] - ETA: 6s - loss: 0.3405 - acc: 0.8782
18912/60000 [========>.....................] - ETA: 6s - loss: 0.3398 - acc: 0.8785
19328/60000 [========>.....................] - ETA: 5s - loss: 0.3388 - acc: 0.8786
19744/60000 [========>.....................] - ETA: 5s - loss: 0.3398 - acc: 0.8779
20224/60000 [=========>....................] - ETA: 5s - loss: 0.3399 - acc: 0.8777
20704/60000 [=========>....................] - ETA: 5s - loss: 0.3418 - acc: 0.8773
21120/60000 [=========>....................] - ETA: 5s - loss: 0.3420 - acc: 0.8770
21568/60000 [=========>....................] - ETA: 5s - loss: 0.3419 - acc: 0.8766
21952/60000 [=========>....................] - ETA: 5s - loss: 0.3433 - acc: 0.8765
22368/60000 [==========>...................] - ETA: 5s - loss: 0.3433 - acc: 0.8766
22720/60000 [==========>...................] - ETA: 5s - loss: 0.3431 - acc: 0.8768
23104/60000 [==========>...................] - ETA: 5s - loss: 0.3425 - acc: 0.8771
23488/60000 [==========>...................] - ETA: 5s - loss: 0.3406 - acc: 0.8779
23936/60000 [==========>...................] - ETA: 5s - loss: 0.3396 - acc: 0.8780
24320/60000 [===========>..................] - ETA: 5s - loss: 0.3393 - acc: 0.8782
24768/60000 [===========>..................] - ETA: 5s - loss: 0.3395 - acc: 0.8778
25248/60000 [===========>..................] - ETA: 4s - loss: 0.3393 - acc: 0.8779
25696/60000 [===========>..................] - ETA: 4s - loss: 0.3395 - acc: 0.8778
26048/60000 [============>.................] - ETA: 4s - loss: 0.3397 - acc: 0.8778
26496/60000 [============>.................] - ETA: 4s - loss: 0.3390 - acc: 0.8782
26976/60000 [============>.................] - ETA: 4s - loss: 0.3398 - acc: 0.8777
27456/60000 [============>.................] - ETA: 4s - loss: 0.3403 - acc: 0.8775
27872/60000 [============>.................] - ETA: 4s - loss: 0.3400 - acc: 0.8777
28320/60000 [=============>................] - ETA: 4s - loss: 0.3405 - acc: 0.8773
28800/60000 [=============>................] - ETA: 4s - loss: 0.3411 - acc: 0.8769
29280/60000 [=============>................] - ETA: 4s - loss: 0.3417 - acc: 0.8766
29632/60000 [=============>................] - ETA: 4s - loss: 0.3413 - acc: 0.8767
30048/60000 [==============>...............] - ETA: 4s - loss: 0.3409 - acc: 0.8770
30464/60000 [==============>...............] - ETA: 4s - loss: 0.3419 - acc: 0.8769
30912/60000 [==============>...............] - ETA: 4s - loss: 0.3430 - acc: 0.8765
31296/60000 [==============>...............] - ETA: 3s - loss: 0.3438 - acc: 0.8759
31712/60000 [==============>...............] - ETA: 3s - loss: 0.3441 - acc: 0.8756
32160/60000 [===============>..............] - ETA: 3s - loss: 0.3442 - acc: 0.8757
32608/60000 [===============>..............] - ETA: 3s - loss: 0.3442 - acc: 0.8758
32992/60000 [===============>..............] - ETA: 3s - loss: 0.3437 - acc: 0.8759
33440/60000 [===============>..............] - ETA: 3s - loss: 0.3450 - acc: 0.8754
33632/60000 [===============>..............] - ETA: 3s - loss: 0.3449 - acc: 0.8752
33856/60000 [===============>..............] - ETA: 3s - loss: 0.3449 - acc: 0.8750
34080/60000 [================>.............] - ETA: 3s - loss: 0.3446 - acc: 0.8752
34304/60000 [================>.............] - ETA: 3s - loss: 0.3446 - acc: 0.8752
34496/60000 [================>.............] - ETA: 3s - loss: 0.3449 - acc: 0.8752
34656/60000 [================>.............] - ETA: 3s - loss: 0.3448 - acc: 0.8753
34880/60000 [================>.............] - ETA: 3s - loss: 0.3445 - acc: 0.8753
35200/60000 [================>.............] - ETA: 3s - loss: 0.3442 - acc: 0.8755
35648/60000 [================>.............] - ETA: 3s - loss: 0.3435 - acc: 0.8758
36128/60000 [=================>............] - ETA: 3s - loss: 0.3427 - acc: 0.8758
36576/60000 [=================>............] - ETA: 3s - loss: 0.3427 - acc: 0.8758
36832/60000 [=================>............] - ETA: 3s - loss: 0.3425 - acc: 0.8760
37248/60000 [=================>............] - ETA: 3s - loss: 0.3427 - acc: 0.8759
37696/60000 [=================>............] - ETA: 3s - loss: 0.3423 - acc: 0.8761
38112/60000 [==================>...........] - ETA: 3s - loss: 0.3424 - acc: 0.8763
38464/60000 [==================>...........] - ETA: 3s - loss: 0.3429 - acc: 0.8761
38848/60000 [==================>...........] - ETA: 2s - loss: 0.3428 - acc: 0.8762
39296/60000 [==================>...........] - ETA: 2s - loss: 0.3430 - acc: 0.8761
39744/60000 [==================>...........] - ETA: 2s - loss: 0.3428 - acc: 0.8759
40192/60000 [===================>..........] - ETA: 2s - loss: 0.3428 - acc: 0.8758
40640/60000 [===================>..........] - ETA: 2s - loss: 0.3430 - acc: 0.8756
41120/60000 [===================>..........] - ETA: 2s - loss: 0.3423 - acc: 0.8758
41600/60000 [===================>..........] - ETA: 2s - loss: 0.3423 - acc: 0.8757
42080/60000 [====================>.........] - ETA: 2s - loss: 0.3422 - acc: 0.8758
42528/60000 [====================>.........] - ETA: 2s - loss: 0.3420 - acc: 0.8760
43008/60000 [====================>.........] - ETA: 2s - loss: 0.3427 - acc: 0.8758
43488/60000 [====================>.........] - ETA: 2s - loss: 0.3427 - acc: 0.8758
43968/60000 [====================>.........] - ETA: 2s - loss: 0.3427 - acc: 0.8758
44416/60000 [=====================>........] - ETA: 2s - loss: 0.3424 - acc: 0.8760
44864/60000 [=====================>........] - ETA: 2s - loss: 0.3426 - acc: 0.8759
45344/60000 [=====================>........] - ETA: 2s - loss: 0.3423 - acc: 0.8760
45824/60000 [=====================>........] - ETA: 1s - loss: 0.3424 - acc: 0.8761
46304/60000 [======================>.......] - ETA: 1s - loss: 0.3425 - acc: 0.8763
46784/60000 [======================>.......] - ETA: 1s - loss: 0.3428 - acc: 0.8762
47264/60000 [======================>.......] - ETA: 1s - loss: 0.3421 - acc: 0.8764
47744/60000 [======================>.......] - ETA: 1s - loss: 0.3420 - acc: 0.8764
48192/60000 [=======================>......] - ETA: 1s - loss: 0.3417 - acc: 0.8762
48640/60000 [=======================>......] - ETA: 1s - loss: 0.3412 - acc: 0.8763
49120/60000 [=======================>......] - ETA: 1s - loss: 0.3405 - acc: 0.8766
49600/60000 [=======================>......] - ETA: 1s - loss: 0.3399 - acc: 0.8769
50016/60000 [========================>.....] - ETA: 1s - loss: 0.3396 - acc: 0.8769
50368/60000 [========================>.....] - ETA: 1s - loss: 0.3396 - acc: 0.8770
50720/60000 [========================>.....] - ETA: 1s - loss: 0.3397 - acc: 0.8769
51072/60000 [========================>.....] - ETA: 1s - loss: 0.3396 - acc: 0.8770
51424/60000 [========================>.....] - ETA: 1s - loss: 0.3396 - acc: 0.8769
51808/60000 [========================>.....] - ETA: 1s - loss: 0.3393 - acc: 0.8769
52128/60000 [=========================>....] - ETA: 1s - loss: 0.3396 - acc: 0.8768
52384/60000 [=========================>....] - ETA: 1s - loss: 0.3398 - acc: 0.8767
52544/60000 [=========================>....] - ETA: 1s - loss: 0.3399 - acc: 0.8766
52992/60000 [=========================>....] - ETA: 0s - loss: 0.3394 - acc: 0.8769
53472/60000 [=========================>....] - ETA: 0s - loss: 0.3394 - acc: 0.8768
53952/60000 [=========================>....] - ETA: 0s - loss: 0.3395 - acc: 0.8768
54400/60000 [==========================>...] - ETA: 0s - loss: 0.3390 - acc: 0.8770
54848/60000 [==========================>...] - ETA: 0s - loss: 0.3389 - acc: 0.8770
55328/60000 [==========================>...] - ETA: 0s - loss: 0.3387 - acc: 0.8772
55808/60000 [==========================>...] - ETA: 0s - loss: 0.3387 - acc: 0.8770
56256/60000 [===========================>..] - ETA: 0s - loss: 0.3384 - acc: 0.8771
56736/60000 [===========================>..] - ETA: 0s - loss: 0.3383 - acc: 0.8770
57216/60000 [===========================>..] - ETA: 0s - loss: 0.3381 - acc: 0.8771
57696/60000 [===========================>..] - ETA: 0s - loss: 0.3380 - acc: 0.8771
58176/60000 [============================>.] - ETA: 0s - loss: 0.3382 - acc: 0.8770
58656/60000 [============================>.] - ETA: 0s - loss: 0.3380 - acc: 0.8771
59136/60000 [============================>.] - ETA: 0s - loss: 0.3378 - acc: 0.8772
59616/60000 [============================>.] - ETA: 0s - loss: 0.3374 - acc: 0.8773
60000/60000 [==============================] - 8s 133us/step - loss: 0.3372 - acc: 0.8773
Epoch 4/5
32/60000 [..............................] - ETA: 9s - loss: 0.3326 - acc: 0.9062
480/60000 [..............................] - ETA: 6s - loss: 0.2988 - acc: 0.8812
928/60000 [..............................] - ETA: 6s - loss: 0.3335 - acc: 0.8825
1376/60000 [..............................] - ETA: 6s - loss: 0.3423 - acc: 0.8714
1824/60000 [..............................] - ETA: 6s - loss: 0.3386 - acc: 0.8761
2080/60000 [>.............................] - ETA: 7s - loss: 0.3433 - acc: 0.8745
2368/60000 [>.............................] - ETA: 7s - loss: 0.3380 - acc: 0.8780
2784/60000 [>.............................] - ETA: 7s - loss: 0.3373 - acc: 0.8786
3232/60000 [>.............................] - ETA: 7s - loss: 0.3386 - acc: 0.8775
3616/60000 [>.............................] - ETA: 7s - loss: 0.3318 - acc: 0.8805
4064/60000 [=>............................] - ETA: 7s - loss: 0.3248 - acc: 0.8829
4480/60000 [=>............................] - ETA: 7s - loss: 0.3283 - acc: 0.8799
4928/60000 [=>............................] - ETA: 7s - loss: 0.3301 - acc: 0.8787
5248/60000 [=>............................] - ETA: 7s - loss: 0.3269 - acc: 0.8796
5536/60000 [=>............................] - ETA: 7s - loss: 0.3240 - acc: 0.8802
5728/60000 [=>............................] - ETA: 7s - loss: 0.3220 - acc: 0.8809
5920/60000 [=>............................] - ETA: 7s - loss: 0.3235 - acc: 0.8812
6208/60000 [==>...........................] - ETA: 7s - loss: 0.3254 - acc: 0.8792
6528/60000 [==>...........................] - ETA: 7s - loss: 0.3209 - acc: 0.8805
6880/60000 [==>...........................] - ETA: 7s - loss: 0.3254 - acc: 0.8792
7232/60000 [==>...........................] - ETA: 7s - loss: 0.3226 - acc: 0.8809
7552/60000 [==>...........................] - ETA: 7s - loss: 0.3227 - acc: 0.8810
7872/60000 [==>...........................] - ETA: 7s - loss: 0.3191 - acc: 0.8824
8256/60000 [===>..........................] - ETA: 7s - loss: 0.3207 - acc: 0.8814
8480/60000 [===>..........................] - ETA: 7s - loss: 0.3194 - acc: 0.8817
8800/60000 [===>..........................] - ETA: 7s - loss: 0.3210 - acc: 0.8823
9120/60000 [===>..........................] - ETA: 7s - loss: 0.3194 - acc: 0.8826
9472/60000 [===>..........................] - ETA: 7s - loss: 0.3192 - acc: 0.8822
9824/60000 [===>..........................] - ETA: 7s - loss: 0.3182 - acc: 0.8824
10144/60000 [====>.........................] - ETA: 7s - loss: 0.3196 - acc: 0.8825
10464/60000 [====>.........................] - ETA: 7s - loss: 0.3205 - acc: 0.8824
10816/60000 [====>.........................] - ETA: 7s - loss: 0.3206 - acc: 0.8823
11200/60000 [====>.........................] - ETA: 7s - loss: 0.3209 - acc: 0.8820
11488/60000 [====>.........................] - ETA: 7s - loss: 0.3213 - acc: 0.8824
11872/60000 [====>.........................] - ETA: 7s - loss: 0.3244 - acc: 0.8808
12352/60000 [=====>........................] - ETA: 7s - loss: 0.3238 - acc: 0.8803
12832/60000 [=====>........................] - ETA: 7s - loss: 0.3234 - acc: 0.8800
13248/60000 [=====>........................] - ETA: 7s - loss: 0.3250 - acc: 0.8795
13664/60000 [=====>........................] - ETA: 6s - loss: 0.3246 - acc: 0.8797
14144/60000 [======>.......................] - ETA: 6s - loss: 0.3265 - acc: 0.8790
14592/60000 [======>.......................] - ETA: 6s - loss: 0.3264 - acc: 0.8789
14944/60000 [======>.......................] - ETA: 6s - loss: 0.3273 - acc: 0.8786
15360/60000 [======>.......................] - ETA: 6s - loss: 0.3256 - acc: 0.8793
15680/60000 [======>.......................] - ETA: 6s - loss: 0.3252 - acc: 0.8794
16128/60000 [=======>......................] - ETA: 6s - loss: 0.3255 - acc: 0.8795
16608/60000 [=======>......................] - ETA: 6s - loss: 0.3269 - acc: 0.8789
17024/60000 [=======>......................] - ETA: 6s - loss: 0.3249 - acc: 0.8801
17472/60000 [=======>......................] - ETA: 6s - loss: 0.3250 - acc: 0.8799
17920/60000 [=======>......................] - ETA: 6s - loss: 0.3246 - acc: 0.8800
18368/60000 [========>.....................] - ETA: 5s - loss: 0.3247 - acc: 0.8796
18784/60000 [========>.....................] - ETA: 5s - loss: 0.3244 - acc: 0.8801
19232/60000 [========>.....................] - ETA: 5s - loss: 0.3234 - acc: 0.8803
19680/60000 [========>.....................] - ETA: 5s - loss: 0.3232 - acc: 0.8802
20096/60000 [=========>....................] - ETA: 5s - loss: 0.3225 - acc: 0.8804
20512/60000 [=========>....................] - ETA: 5s - loss: 0.3222 - acc: 0.8807
20960/60000 [=========>....................] - ETA: 5s - loss: 0.3205 - acc: 0.8814
21440/60000 [=========>....................] - ETA: 5s - loss: 0.3193 - acc: 0.8819
21888/60000 [=========>....................] - ETA: 5s - loss: 0.3189 - acc: 0.8825
22304/60000 [==========>...................] - ETA: 5s - loss: 0.3195 - acc: 0.8825
22720/60000 [==========>...................] - ETA: 5s - loss: 0.3198 - acc: 0.8822
23168/60000 [==========>...................] - ETA: 5s - loss: 0.3203 - acc: 0.8819
23616/60000 [==========>...................] - ETA: 4s - loss: 0.3207 - acc: 0.8816
23936/60000 [==========>...................] - ETA: 4s - loss: 0.3207 - acc: 0.8817
24288/60000 [===========>..................] - ETA: 4s - loss: 0.3205 - acc: 0.8818
24672/60000 [===========>..................] - ETA: 4s - loss: 0.3205 - acc: 0.8818
25120/60000 [===========>..................] - ETA: 4s - loss: 0.3199 - acc: 0.8814
25472/60000 [===========>..................] - ETA: 4s - loss: 0.3195 - acc: 0.8814
25888/60000 [===========>..................] - ETA: 4s - loss: 0.3199 - acc: 0.8814
26368/60000 [============>.................] - ETA: 4s - loss: 0.3211 - acc: 0.8814
26848/60000 [============>.................] - ETA: 4s - loss: 0.3212 - acc: 0.8816
27232/60000 [============>.................] - ETA: 4s - loss: 0.3203 - acc: 0.8821
27648/60000 [============>.................] - ETA: 4s - loss: 0.3206 - acc: 0.8821
28000/60000 [=============>................] - ETA: 4s - loss: 0.3214 - acc: 0.8816
28448/60000 [=============>................] - ETA: 4s - loss: 0.3212 - acc: 0.8818
28832/60000 [=============>................] - ETA: 4s - loss: 0.3214 - acc: 0.8815
29280/60000 [=============>................] - ETA: 4s - loss: 0.3211 - acc: 0.8817
29760/60000 [=============>................] - ETA: 4s - loss: 0.3208 - acc: 0.8819
30240/60000 [==============>...............] - ETA: 4s - loss: 0.3211 - acc: 0.8818
30656/60000 [==============>...............] - ETA: 3s - loss: 0.3208 - acc: 0.8820
31008/60000 [==============>...............] - ETA: 3s - loss: 0.3206 - acc: 0.8823
31392/60000 [==============>...............] - ETA: 3s - loss: 0.3203 - acc: 0.8824
31712/60000 [==============>...............] - ETA: 3s - loss: 0.3199 - acc: 0.8823
32000/60000 [===============>..............] - ETA: 3s - loss: 0.3194 - acc: 0.8825
32352/60000 [===============>..............] - ETA: 3s - loss: 0.3193 - acc: 0.8828
32736/60000 [===============>..............] - ETA: 3s - loss: 0.3192 - acc: 0.8829
33120/60000 [===============>..............] - ETA: 3s - loss: 0.3199 - acc: 0.8827
33408/60000 [===============>..............] - ETA: 3s - loss: 0.3200 - acc: 0.8828
33760/60000 [===============>..............] - ETA: 3s - loss: 0.3199 - acc: 0.8828
34144/60000 [================>.............] - ETA: 3s - loss: 0.3204 - acc: 0.8828
34528/60000 [================>.............] - ETA: 3s - loss: 0.3208 - acc: 0.8826
34912/60000 [================>.............] - ETA: 3s - loss: 0.3205 - acc: 0.8830
35264/60000 [================>.............] - ETA: 3s - loss: 0.3204 - acc: 0.8831
35616/60000 [================>.............] - ETA: 3s - loss: 0.3210 - acc: 0.8827
36000/60000 [=================>............] - ETA: 3s - loss: 0.3207 - acc: 0.8829
36384/60000 [=================>............] - ETA: 3s - loss: 0.3199 - acc: 0.8831
36736/60000 [=================>............] - ETA: 3s - loss: 0.3197 - acc: 0.8834
37120/60000 [=================>............] - ETA: 3s - loss: 0.3195 - acc: 0.8833
37536/60000 [=================>............] - ETA: 3s - loss: 0.3198 - acc: 0.8831
37984/60000 [=================>............] - ETA: 2s - loss: 0.3194 - acc: 0.8836
38368/60000 [==================>...........] - ETA: 2s - loss: 0.3191 - acc: 0.8838
38784/60000 [==================>...........] - ETA: 2s - loss: 0.3184 - acc: 0.8839
39072/60000 [==================>...........] - ETA: 2s - loss: 0.3184 - acc: 0.8838
39488/60000 [==================>...........] - ETA: 2s - loss: 0.3179 - acc: 0.8840
39840/60000 [==================>...........] - ETA: 2s - loss: 0.3172 - acc: 0.8843
40160/60000 [===================>..........] - ETA: 2s - loss: 0.3179 - acc: 0.8841
40480/60000 [===================>..........] - ETA: 2s - loss: 0.3177 - acc: 0.8843
40800/60000 [===================>..........] - ETA: 2s - loss: 0.3173 - acc: 0.8843
41088/60000 [===================>..........] - ETA: 2s - loss: 0.3171 - acc: 0.8843
41408/60000 [===================>..........] - ETA: 2s - loss: 0.3172 - acc: 0.8841
41760/60000 [===================>..........] - ETA: 2s - loss: 0.3168 - acc: 0.8841
42144/60000 [====================>.........] - ETA: 2s - loss: 0.3162 - acc: 0.8844
42464/60000 [====================>.........] - ETA: 2s - loss: 0.3156 - acc: 0.8847
42880/60000 [====================>.........] - ETA: 2s - loss: 0.3160 - acc: 0.8847
43328/60000 [====================>.........] - ETA: 2s - loss: 0.3160 - acc: 0.8846
43744/60000 [====================>.........] - ETA: 2s - loss: 0.3160 - acc: 0.8846
44064/60000 [=====================>........] - ETA: 2s - loss: 0.3160 - acc: 0.8847
44384/60000 [=====================>........] - ETA: 2s - loss: 0.3160 - acc: 0.8845
44736/60000 [=====================>........] - ETA: 2s - loss: 0.3162 - acc: 0.8845
45120/60000 [=====================>........] - ETA: 2s - loss: 0.3161 - acc: 0.8846
45504/60000 [=====================>........] - ETA: 1s - loss: 0.3157 - acc: 0.8849
45856/60000 [=====================>........] - ETA: 1s - loss: 0.3160 - acc: 0.8847
46240/60000 [======================>.......] - ETA: 1s - loss: 0.3155 - acc: 0.8849
46720/60000 [======================>.......] - ETA: 1s - loss: 0.3154 - acc: 0.8848
47136/60000 [======================>.......] - ETA: 1s - loss: 0.3153 - acc: 0.8849
47584/60000 [======================>.......] - ETA: 1s - loss: 0.3153 - acc: 0.8849
48064/60000 [=======================>......] - ETA: 1s - loss: 0.3153 - acc: 0.8850
48512/60000 [=======================>......] - ETA: 1s - loss: 0.3148 - acc: 0.8852
48800/60000 [=======================>......] - ETA: 1s - loss: 0.3147 - acc: 0.8853
49152/60000 [=======================>......] - ETA: 1s - loss: 0.3147 - acc: 0.8854
49600/60000 [=======================>......] - ETA: 1s - loss: 0.3148 - acc: 0.8854
49984/60000 [=======================>......] - ETA: 1s - loss: 0.3144 - acc: 0.8856
50368/60000 [========================>.....] - ETA: 1s - loss: 0.3146 - acc: 0.8855
50816/60000 [========================>.....] - ETA: 1s - loss: 0.3147 - acc: 0.8854
51296/60000 [========================>.....] - ETA: 1s - loss: 0.3145 - acc: 0.8855
51776/60000 [========================>.....] - ETA: 1s - loss: 0.3145 - acc: 0.8855
52224/60000 [=========================>....] - ETA: 1s - loss: 0.3146 - acc: 0.8856
52672/60000 [=========================>....] - ETA: 0s - loss: 0.3147 - acc: 0.8856
53152/60000 [=========================>....] - ETA: 0s - loss: 0.3146 - acc: 0.8857
53632/60000 [=========================>....] - ETA: 0s - loss: 0.3150 - acc: 0.8854
54016/60000 [==========================>...] - ETA: 0s - loss: 0.3152 - acc: 0.8854
54400/60000 [==========================>...] - ETA: 0s - loss: 0.3148 - acc: 0.8855
54880/60000 [==========================>...] - ETA: 0s - loss: 0.3145 - acc: 0.8855
55328/60000 [==========================>...] - ETA: 0s - loss: 0.3144 - acc: 0.8855
55680/60000 [==========================>...] - ETA: 0s - loss: 0.3143 - acc: 0.8855
56064/60000 [===========================>..] - ETA: 0s - loss: 0.3139 - acc: 0.8857
56544/60000 [===========================>..] - ETA: 0s - loss: 0.3138 - acc: 0.8858
57024/60000 [===========================>..] - ETA: 0s - loss: 0.3133 - acc: 0.8859
57440/60000 [===========================>..] - ETA: 0s - loss: 0.3133 - acc: 0.8860
57888/60000 [===========================>..] - ETA: 0s - loss: 0.3134 - acc: 0.8858
58272/60000 [============================>.] - ETA: 0s - loss: 0.3135 - acc: 0.8857
58720/60000 [============================>.] - ETA: 0s - loss: 0.3131 - acc: 0.8858
59136/60000 [============================>.] - ETA: 0s - loss: 0.3132 - acc: 0.8859
59584/60000 [============================>.] - ETA: 0s - loss: 0.3135 - acc: 0.8858
60000/60000 [==============================] - 8s 134us/step - loss: 0.3136 - acc: 0.8857
Epoch 5/5
32/60000 [..............................] - ETA: 9s - loss: 0.1876 - acc: 0.9375
512/60000 [..............................] - ETA: 6s - loss: 0.3564 - acc: 0.8828
864/60000 [..............................] - ETA: 7s - loss: 0.3402 - acc: 0.8762
1280/60000 [..............................] - ETA: 7s - loss: 0.3159 - acc: 0.8852
1760/60000 [..............................] - ETA: 7s - loss: 0.3254 - acc: 0.8824
2208/60000 [>.............................] - ETA: 7s - loss: 0.3292 - acc: 0.8818
2528/60000 [>.............................] - ETA: 7s - loss: 0.3294 - acc: 0.8841
2944/60000 [>.............................] - ETA: 7s - loss: 0.3286 - acc: 0.8842
3424/60000 [>.............................] - ETA: 7s - loss: 0.3195 - acc: 0.8870
3904/60000 [>.............................] - ETA: 6s - loss: 0.3197 - acc: 0.8878
4320/60000 [=>............................] - ETA: 6s - loss: 0.3196 - acc: 0.8868
4768/60000 [=>............................] - ETA: 6s - loss: 0.3203 - acc: 0.8840
5248/60000 [=>............................] - ETA: 6s - loss: 0.3141 - acc: 0.8861
5728/60000 [=>............................] - ETA: 6s - loss: 0.3136 - acc: 0.8850
6144/60000 [==>...........................] - ETA: 6s - loss: 0.3139 - acc: 0.8848
6560/60000 [==>...........................] - ETA: 6s - loss: 0.3122 - acc: 0.8855
7008/60000 [==>...........................] - ETA: 6s - loss: 0.3105 - acc: 0.8864
7488/60000 [==>...........................] - ETA: 6s - loss: 0.3077 - acc: 0.8880
7840/60000 [==>...........................] - ETA: 6s - loss: 0.3091 - acc: 0.8871
8288/60000 [===>..........................] - ETA: 6s - loss: 0.3094 - acc: 0.8867
8768/60000 [===>..........................] - ETA: 6s - loss: 0.3088 - acc: 0.8867
9248/60000 [===>..........................] - ETA: 6s - loss: 0.3090 - acc: 0.8866
9664/60000 [===>..........................] - ETA: 6s - loss: 0.3079 - acc: 0.8869
10112/60000 [====>.........................] - ETA: 5s - loss: 0.3052 - acc: 0.8884
10592/60000 [====>.........................] - ETA: 5s - loss: 0.3019 - acc: 0.8898
10976/60000 [====>.........................] - ETA: 5s - loss: 0.3018 - acc: 0.8895
11392/60000 [====>.........................] - ETA: 5s - loss: 0.3004 - acc: 0.8899
11840/60000 [====>.........................] - ETA: 5s - loss: 0.2978 - acc: 0.8910
12320/60000 [=====>........................] - ETA: 5s - loss: 0.2965 - acc: 0.8914
12800/60000 [=====>........................] - ETA: 5s - loss: 0.2975 - acc: 0.8907
13216/60000 [=====>........................] - ETA: 5s - loss: 0.2975 - acc: 0.8907
13664/60000 [=====>........................] - ETA: 5s - loss: 0.2991 - acc: 0.8899
14144/60000 [======>.......................] - ETA: 5s - loss: 0.3001 - acc: 0.8889
14624/60000 [======>.......................] - ETA: 5s - loss: 0.3001 - acc: 0.8890
15040/60000 [======>.......................] - ETA: 5s - loss: 0.3002 - acc: 0.8891
15360/60000 [======>.......................] - ETA: 5s - loss: 0.3002 - acc: 0.8895
15744/60000 [======>.......................] - ETA: 5s - loss: 0.3002 - acc: 0.8893
16128/60000 [=======>......................] - ETA: 5s - loss: 0.3000 - acc: 0.8895
16480/60000 [=======>......................] - ETA: 5s - loss: 0.3014 - acc: 0.8890
16864/60000 [=======>......................] - ETA: 5s - loss: 0.3015 - acc: 0.8891
17280/60000 [=======>......................] - ETA: 5s - loss: 0.3009 - acc: 0.8889
17696/60000 [=======>......................] - ETA: 5s - loss: 0.3019 - acc: 0.8885
18080/60000 [========>.....................] - ETA: 5s - loss: 0.3019 - acc: 0.8888
18464/60000 [========>.....................] - ETA: 5s - loss: 0.3017 - acc: 0.8886
18816/60000 [========>.....................] - ETA: 5s - loss: 0.3029 - acc: 0.8882
19168/60000 [========>.....................] - ETA: 5s - loss: 0.3027 - acc: 0.8885
19520/60000 [========>.....................] - ETA: 4s - loss: 0.3040 - acc: 0.8882
19904/60000 [========>.....................] - ETA: 4s - loss: 0.3042 - acc: 0.8885
20352/60000 [=========>....................] - ETA: 4s - loss: 0.3050 - acc: 0.8883
20832/60000 [=========>....................] - ETA: 4s - loss: 0.3045 - acc: 0.8885
21216/60000 [=========>....................] - ETA: 4s - loss: 0.3053 - acc: 0.8880
21664/60000 [=========>....................] - ETA: 4s - loss: 0.3036 - acc: 0.8884
22144/60000 [==========>...................] - ETA: 4s - loss: 0.3032 - acc: 0.8885
22624/60000 [==========>...................] - ETA: 4s - loss: 0.3022 - acc: 0.8887
22944/60000 [==========>...................] - ETA: 4s - loss: 0.3024 - acc: 0.8886
23360/60000 [==========>...................] - ETA: 4s - loss: 0.3020 - acc: 0.8887
23840/60000 [==========>...................] - ETA: 4s - loss: 0.3015 - acc: 0.8888
24320/60000 [===========>..................] - ETA: 4s - loss: 0.3021 - acc: 0.8883
24736/60000 [===========>..................] - ETA: 4s - loss: 0.3023 - acc: 0.8881
25184/60000 [===========>..................] - ETA: 4s - loss: 0.3019 - acc: 0.8881
25664/60000 [===========>..................] - ETA: 4s - loss: 0.3018 - acc: 0.8881
26144/60000 [============>.................] - ETA: 4s - loss: 0.3026 - acc: 0.8878
26560/60000 [============>.................] - ETA: 4s - loss: 0.3014 - acc: 0.8883
27008/60000 [============>.................] - ETA: 4s - loss: 0.3013 - acc: 0.8883
27360/60000 [============>.................] - ETA: 3s - loss: 0.3000 - acc: 0.8886
27840/60000 [============>.................] - ETA: 3s - loss: 0.3005 - acc: 0.8883
28256/60000 [=============>................] - ETA: 3s - loss: 0.3008 - acc: 0.8883
28704/60000 [=============>................] - ETA: 3s - loss: 0.3015 - acc: 0.8882
29152/60000 [=============>................] - ETA: 3s - loss: 0.3013 - acc: 0.8881
29632/60000 [=============>................] - ETA: 3s - loss: 0.3013 - acc: 0.8882
30048/60000 [==============>...............] - ETA: 3s - loss: 0.3011 - acc: 0.8884
30496/60000 [==============>...............] - ETA: 3s - loss: 0.3017 - acc: 0.8882
30976/60000 [==============>...............] - ETA: 3s - loss: 0.3017 - acc: 0.8885
31392/60000 [==============>...............] - ETA: 3s - loss: 0.3020 - acc: 0.8882
31744/60000 [==============>...............] - ETA: 3s - loss: 0.3023 - acc: 0.8881
32160/60000 [===============>..............] - ETA: 3s - loss: 0.3016 - acc: 0.8881
32640/60000 [===============>..............] - ETA: 3s - loss: 0.3019 - acc: 0.8881
33120/60000 [===============>..............] - ETA: 3s - loss: 0.3016 - acc: 0.8884
33440/60000 [===============>..............] - ETA: 3s - loss: 0.3014 - acc: 0.8885
33760/60000 [===============>..............] - ETA: 3s - loss: 0.3018 - acc: 0.8884
34112/60000 [================>.............] - ETA: 3s - loss: 0.3009 - acc: 0.8888
34496/60000 [================>.............] - ETA: 3s - loss: 0.3016 - acc: 0.8887
34816/60000 [================>.............] - ETA: 3s - loss: 0.3018 - acc: 0.8885
35104/60000 [================>.............] - ETA: 3s - loss: 0.3016 - acc: 0.8887
35552/60000 [================>.............] - ETA: 3s - loss: 0.3013 - acc: 0.8890
36000/60000 [=================>............] - ETA: 2s - loss: 0.3006 - acc: 0.8892
36416/60000 [=================>............] - ETA: 2s - loss: 0.3002 - acc: 0.8893
36864/60000 [=================>............] - ETA: 2s - loss: 0.2996 - acc: 0.8896
37344/60000 [=================>............] - ETA: 2s - loss: 0.2992 - acc: 0.8897
37824/60000 [=================>............] - ETA: 2s - loss: 0.2998 - acc: 0.8896
38240/60000 [==================>...........] - ETA: 2s - loss: 0.2998 - acc: 0.8897
38688/60000 [==================>...........] - ETA: 2s - loss: 0.2990 - acc: 0.8899
39168/60000 [==================>...........] - ETA: 2s - loss: 0.2994 - acc: 0.8898
39584/60000 [==================>...........] - ETA: 2s - loss: 0.2993 - acc: 0.8897
40000/60000 [===================>..........] - ETA: 2s - loss: 0.2992 - acc: 0.8899
40448/60000 [===================>..........] - ETA: 2s - loss: 0.2998 - acc: 0.8898
40928/60000 [===================>..........] - ETA: 2s - loss: 0.2994 - acc: 0.8901
41408/60000 [===================>..........] - ETA: 2s - loss: 0.2997 - acc: 0.8899
41792/60000 [===================>..........] - ETA: 2s - loss: 0.2996 - acc: 0.8899
42208/60000 [====================>.........] - ETA: 2s - loss: 0.2992 - acc: 0.8899
42688/60000 [====================>.........] - ETA: 2s - loss: 0.2989 - acc: 0.8899
43168/60000 [====================>.........] - ETA: 2s - loss: 0.2979 - acc: 0.8902
43552/60000 [====================>.........] - ETA: 2s - loss: 0.2981 - acc: 0.8901
43968/60000 [====================>.........] - ETA: 1s - loss: 0.2980 - acc: 0.8902
44416/60000 [=====================>........] - ETA: 1s - loss: 0.2979 - acc: 0.8902
44896/60000 [=====================>........] - ETA: 1s - loss: 0.2982 - acc: 0.8901
45376/60000 [=====================>........] - ETA: 1s - loss: 0.2979 - acc: 0.8902
45792/60000 [=====================>........] - ETA: 1s - loss: 0.2976 - acc: 0.8903
46240/60000 [======================>.......] - ETA: 1s - loss: 0.2977 - acc: 0.8904
46720/60000 [======================>.......] - ETA: 1s - loss: 0.2977 - acc: 0.8903
47200/60000 [======================>.......] - ETA: 1s - loss: 0.2979 - acc: 0.8902
47616/60000 [======================>.......] - ETA: 1s - loss: 0.2978 - acc: 0.8902
48000/60000 [=======================>......] - ETA: 1s - loss: 0.2975 - acc: 0.8904
48480/60000 [=======================>......] - ETA: 1s - loss: 0.2972 - acc: 0.8906
48960/60000 [=======================>......] - ETA: 1s - loss: 0.2970 - acc: 0.8905
49440/60000 [=======================>......] - ETA: 1s - loss: 0.2968 - acc: 0.8906
49888/60000 [=======================>......] - ETA: 1s - loss: 0.2968 - acc: 0.8906
50336/60000 [========================>.....] - ETA: 1s - loss: 0.2967 - acc: 0.8907
50816/60000 [========================>.....] - ETA: 1s - loss: 0.2966 - acc: 0.8909
51296/60000 [========================>.....] - ETA: 1s - loss: 0.2964 - acc: 0.8910
51712/60000 [========================>.....] - ETA: 1s - loss: 0.2963 - acc: 0.8910
52128/60000 [=========================>....] - ETA: 0s - loss: 0.2963 - acc: 0.8911
52576/60000 [=========================>....] - ETA: 0s - loss: 0.2965 - acc: 0.8909
53056/60000 [=========================>....] - ETA: 0s - loss: 0.2966 - acc: 0.8909
53472/60000 [=========================>....] - ETA: 0s - loss: 0.2969 - acc: 0.8907
53920/60000 [=========================>....] - ETA: 0s - loss: 0.2972 - acc: 0.8905
54400/60000 [==========================>...] - ETA: 0s - loss: 0.2969 - acc: 0.8907
54880/60000 [==========================>...] - ETA: 0s - loss: 0.2968 - acc: 0.8907
55296/60000 [==========================>...] - ETA: 0s - loss: 0.2965 - acc: 0.8907
55744/60000 [==========================>...] - ETA: 0s - loss: 0.2964 - acc: 0.8909
56224/60000 [===========================>..] - ETA: 0s - loss: 0.2960 - acc: 0.8909
56640/60000 [===========================>..] - ETA: 0s - loss: 0.2959 - acc: 0.8908
57056/60000 [===========================>..] - ETA: 0s - loss: 0.2960 - acc: 0.8908
57504/60000 [===========================>..] - ETA: 0s - loss: 0.2960 - acc: 0.8907
57984/60000 [===========================>..] - ETA: 0s - loss: 0.2961 - acc: 0.8906
58464/60000 [============================>.] - ETA: 0s - loss: 0.2955 - acc: 0.8908
58912/60000 [============================>.] - ETA: 0s - loss: 0.2957 - acc: 0.8907
59360/60000 [============================>.] - ETA: 0s - loss: 0.2957 - acc: 0.8906
59840/60000 [============================>.] - ETA: 0s - loss: 0.2955 - acc: 0.8907
60000/60000 [==============================] - 7s 120us/step - loss: 0.2954 - acc: 0.8908
通过训练数据可以看出精确度已经达到了88%左右,实际上这并不是一个很高的值,但对于我们学习过程来说已经足够使用了。
评估精度
我们可以运用一行代码来评估整个模型相比于测试数据集的精度:
test_loss, test_acc = model.evaluate(test_images, test_labels)
print('Test accuracy:', test_acc)
输出过程已省略部分,以下是结果
10000/10000 [==============================] - 0s 20us/step
Test accuracy: 0.8693
事实证明,测试数据集的准确性略低于训练数据集的准确性。训练精度和测试精度之间的差距是过度拟合的一个例子。过度拟合是指机器学习模型在新数据上的表现比在训练数据上表现更差。
预测
运用训练后的模型,我们可以对输入数据做一些预测:
predictions = model.predict(test_images)
模型已经预测了测试集中每个图像的标签。我们来看看第一个预测:
print(predictions[0])
[2.5046500e-05, 9.4638374e-08, 2.3706765e-07, 3.2167595e-06,
1.4285071e-06, 2.1461691e-03, 2.6124888e-05, 9.9495485e-02,
1.7809383e-04, 8.9812416e-01]
可以看出,第9个的数值的置信度较高,但是这样观察真是太不容易了,加个函数:
print(np.argmax(predictions[0]))
9
也就是说,神经网络给出的答案是9,也就是属于第九个分类ankle boot,我们可以查看test_labels[0],看它是不是9
print(test_labels[0])
9
但是这样也太不形象了,我们可以运用一些绘图代码来更直观的表示预测结果:
plt.figure(figsize=(10,10))
for i in range(25):
plt.subplot(5,5,i+1)
plt.xticks([])
plt.yticks([])
plt.grid('off')
plt.imshow(test_images[i], cmap=plt.cm.binary)
predicted_label = np.argmax(predictions[I])
true_label = test_labels[I]
if predicted_label == true_label:
color = 'green'
else:
color = 'red'
plt.xlabel("{} ({})".format(class_names[predicted_label],
class_names[true_label]),
color=color)
plt.show()
最后,我们也可以尝试对单个图片的预测
# Grab an image from the test dataset
img = test_images[0]
print(img.shape)
28 x 28
tf.keras模型经过优化,可以同时对一组示例进行预测或集合。因此,即使我们使用单个图像,我们也需要将其添加到列表中:
# Add the image to a batch where it's the only member.
img = (np.expand_dims(img,0))
print(img.shape)
(1, 28, 28)
现在对这个图片进行预测:
predictions = model.predict(img)
print(predictions)
[[2.5046500e-05 9.4638374e-08 2.3706765e-07 3.2167627e-06 1.4285083e-06
2.1461679e-03 2.6124937e-05 9.9495515e-02 1.7809383e-04 8.9812416e-01]]
它返回的是一个列表我们需要把我们的拿出来:
prediction = predictions[0]
print(np.argmax(prediction))
9
和前面一样,确实是9
#title MIT License
#
# Copyright (c) 2017 François Chollet
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.