基于MINIST数据集的卷积神经网络
该代码,使用cnn对MINIST数据集(包含7千张28*28的单通道(灰度图、黑白图)图片)分类(0-9,10个类别)
Keras实例目录
名词解释
mnist,手写数据集。
MNIST(Mixed National Institute of Standards and Technology database)是一个计算机视觉数据集,它包含70000张手写数字的灰度图片,其中每一张图片包含 28 X 28 个像素点。
数据集来自美国国家标准与技术研究所, National Institute of Standards and Technology (NIST). 训练集 (training set) 由来自 250 个不同人手写的数字构成, 其中 50% 是高中学生, 50% 来自人口普查局 (the Census Bureau) 的工作人员. 测试集(test set) 也是同样比例的手写数字数据.
官网详细解介绍 (详情,数据集结构、下载)
cnn(Convolutional Neural Networks),卷积神经网络
代码注释
mnist_cnn.py (点击查看原文)
'''Trains a simple convnet on the MNIST dataset.
训练一个基于MINIST数据集的简单卷积神经网络
Gets to 99.25% test accuracy after 12 epochs
12个周期后达到99.25%的精确度
(there is still a lot of margin for parameter tuning).
(通过参数调整还可提升精确度)
16 seconds per epoch on a GRID K520 GPU.
使用一个GRID K520 GPU (图形处理器)每个周期16秒
'''
from __future__ import print_function
import keras
from keras.datasets import mnist
from keras.models import Sequential
from keras.layers import Dense, Dropout, Flatten
from keras.layers import Conv2D, MaxPooling2D
from keras import backend as K
batch_size = 128
num_classes = 10
epochs = 12
# input image dimensions
# 输入图像维度
img_rows, img_cols = 28, 28
# the data, shuffled and split between train and test sets
# 用于训练和测试的数据集,经过了筛选(清洗、数据样本顺序打乱)和分割(分割为训练和测试集)
(x_train, y_train), (x_test, y_test) = mnist.load_data()
if K.image_data_format() == 'channels_first': # Theano框架,图像通道在前
x_train = x_train.reshape(x_train.shape[0], 1, img_rows, img_cols)
x_test = x_test.reshape(x_test.shape[0], 1, img_rows, img_cols)
input_shape = (1, img_rows, img_cols)
else: # TensorFlow框架,图像通道在后
x_train = x_train.reshape(x_train.shape[0], img_rows, img_cols, 1)
x_test = x_test.reshape(x_test.shape[0], img_rows, img_cols, 1)
input_shape = (img_rows, img_cols, 1)
x_train = x_train.astype('float32')
x_test = x_test.astype('float32')
x_train /= 255
x_test /= 255
print('x_train shape:', x_train.shape)
print(x_train.shape[0], 'train samples')
print(x_test.shape[0], 'test samples')
# convert class vectors to binary class matrices
# 类别向量转为2分类矩阵
y_train = keras.utils.to_categorical(y_train, num_classes)
y_test = keras.utils.to_categorical(y_test, num_classes)
model = Sequential()
model.add(Conv2D(32, kernel_size=(3, 3),
activation='relu',
input_shape=input_shape))
model.add(Conv2D(64, (3, 3), activation='relu'))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Dropout(0.25))
model.add(Flatten())
model.add(Dense(128, activation='relu'))
model.add(Dropout(0.5))
model.add(Dense(num_classes, activation='softmax'))
model.compile(loss=keras.losses.categorical_crossentropy,
optimizer=keras.optimizers.Adadelta(),
metrics=['accuracy'])
model.fit(x_train, y_train,
batch_size=batch_size,
epochs=epochs,
verbose=1,
validation_data=(x_test, y_test))
score = model.evaluate(x_test, y_test, verbose=0)
print('Test loss:', score[0])
print('Test accuracy:', score[1])
代码运行
C:\ProgramData\Anaconda3\python.exe E:/keras-master/examples/mnist_cnn.py
x_train shape: (60000, 28, 28, 1)
60000 train samples
10000 test samples
Train on 60000 samples, validate on 10000 samples
Epoch 1/12
128/60000 [..............................] - ETA: 17:33 - loss: 2.3013 - acc: 0.1016
384/60000 [..............................] - ETA: 5:58 - loss: 2.2054 - acc: 0.2057
640/60000 [..............................] - ETA: 3:39 - loss: 2.1000 - acc: 0.2656
896/60000 [..............................] - ETA: 2:39 - loss: 2.0585 - acc: 0.3114
1152/60000 [..............................] - ETA: 2:06 - loss: 1.9493 - acc: 0.3533
1408/60000 [..............................] - ETA: 1:45 - loss: 1.8618 - acc: 0.3899
1664/60000 [..............................] - ETA: 1:30 - loss: 1.7447 - acc: 0.4255
1920/60000 [..............................] - ETA: 1:19 - loss: 1.6956 - acc: 0.4458
2176/60000 [>.............................] - ETA: 1:11 - loss: 1.6158 - acc: 0.4720
2432/60000 [>.............................] - ETA: 1:04 - loss: 1.5295 - acc: 0.5000
2688/60000 [>.............................] - ETA: 59s - loss: 1.4723 - acc: 0.5179
2944/60000 [>.............................] - ETA: 55s - loss: 1.4236 - acc: 0.5343
3200/60000 [>.............................] - ETA: 51s - loss: 1.3725 - acc: 0.5531
3456/60000 [>.............................] - ETA: 48s - loss: 1.3395 - acc: 0.5639
3712/60000 [>.............................] - ETA: 45s - loss: 1.2918 - acc: 0.5787
3968/60000 [>.............................] - ETA: 43s - loss: 1.2571 - acc: 0.5895
4224/60000 [=>............................] - ETA: 41s - loss: 1.2198 - acc: 0.6039
4480/60000 [=>............................] - ETA: 39s - loss: 1.1782 - acc: 0.6192
4736/60000 [=>............................] - ETA: 37s - loss: 1.1437 - acc: 0.6303
4992/60000 [=>............................] - ETA: 35s - loss: 1.1125 - acc: 0.6418
5248/60000 [=>............................] - ETA: 34s - loss: 1.0821 - acc: 0.6522
5504/60000 [=>............................] - ETA: 33s - loss: 1.0626 - acc: 0.6593
5760/60000 [=>............................] - ETA: 32s - loss: 1.0387 - acc: 0.6675
6016/60000 [==>...........................] - ETA: 31s - loss: 1.0138 - acc: 0.6754
6272/60000 [==>...........................] - ETA: 30s - loss: 0.9881 - acc: 0.6826
6528/60000 [==>...........................] - ETA: 29s - loss: 0.9697 - acc: 0.6896
6784/60000 [==>...........................] - ETA: 28s - loss: 0.9445 - acc: 0.6974
7040/60000 [==>...........................] - ETA: 27s - loss: 0.9242 - acc: 0.7043
7296/60000 [==>...........................] - ETA: 27s - loss: 0.9089 - acc: 0.7097
7552/60000 [==>...........................] - ETA: 26s - loss: 0.8903 - acc: 0.7154
7808/60000 [==>...........................] - ETA: 25s - loss: 0.8753 - acc: 0.7200
8064/60000 [===>..........................] - ETA: 25s - loss: 0.8600 - acc: 0.7248
8320/60000 [===>..........................] - ETA: 24s - loss: 0.8473 - acc: 0.7284
8576/60000 [===>..........................] - ETA: 24s - loss: 0.8321 - acc: 0.7334
8832/60000 [===>..........................] - ETA: 23s - loss: 0.8148 - acc: 0.7389
9088/60000 [===>..........................] - ETA: 23s - loss: 0.8029 - acc: 0.7435
9344/60000 [===>..........................] - ETA: 22s - loss: 0.7905 - acc: 0.7474
9600/60000 [===>..........................] - ETA: 22s - loss: 0.7770 - acc: 0.7511
9856/60000 [===>..........................] - ETA: 21s - loss: 0.7664 - acc: 0.7541
10112/60000 [====>.........................] - ETA: 21s - loss: 0.7570 - acc: 0.7564
10368/60000 [====>.........................] - ETA: 21s - loss: 0.7452 - acc: 0.7603
10624/60000 [====>.........................] - ETA: 20s - loss: 0.7340 - acc: 0.7643
10880/60000 [====>.........................] - ETA: 20s - loss: 0.7271 - acc: 0.7666
11136/60000 [====>.........................] - ETA: 19s - loss: 0.7192 - acc: 0.7697
11392/60000 [====>.........................] - ETA: 19s - loss: 0.7102 - acc: 0.7722
11648/60000 [====>.........................] - ETA: 19s - loss: 0.7039 - acc: 0.7749
11904/60000 [====>.........................] - ETA: 19s - loss: 0.6959 - acc: 0.7778
12160/60000 [=====>........................] - ETA: 18s - loss: 0.6867 - acc: 0.7810
12416/60000 [=====>........................] - ETA: 18s - loss: 0.6764 - acc: 0.7844
12672/60000 [=====>........................] - ETA: 18s - loss: 0.6674 - acc: 0.7875
12928/60000 [=====>........................] - ETA: 17s - loss: 0.6589 - acc: 0.7901
13184/60000 [=====>........................] - ETA: 17s - loss: 0.6508 - acc: 0.7928
13440/60000 [=====>........................] - ETA: 17s - loss: 0.6440 - acc: 0.7951
13696/60000 [=====>........................] - ETA: 17s - loss: 0.6393 - acc: 0.7972
13952/60000 [=====>........................] - ETA: 16s - loss: 0.6327 - acc: 0.7994
14208/60000 [======>.......................] - ETA: 16s - loss: 0.6271 - acc: 0.8009
14464/60000 [======>.......................] - ETA: 16s - loss: 0.6200 - acc: 0.8033
14720/60000 [======>.......................] - ETA: 16s - loss: 0.6143 - acc: 0.8056
14976/60000 [======>.......................] - ETA: 16s - loss: 0.6072 - acc: 0.8078
15232/60000 [======>.......................] - ETA: 15s - loss: 0.6004 - acc: 0.8099
15488/60000 [======>.......................] - ETA: 15s - loss: 0.5950 - acc: 0.8117
15744/60000 [======>.......................] - ETA: 15s - loss: 0.5889 - acc: 0.8136
16000/60000 [=======>......................] - ETA: 15s - loss: 0.5831 - acc: 0.8153
16256/60000 [=======>......................] - ETA: 15s - loss: 0.5770 - acc: 0.8172
16512/60000 [=======>......................] - ETA: 14s - loss: 0.5734 - acc: 0.8185
16768/60000 [=======>......................] - ETA: 14s - loss: 0.5701 - acc: 0.8195
17024/60000 [=======>......................] - ETA: 14s - loss: 0.5650 - acc: 0.8211
17280/60000 [=======>......................] - ETA: 14s - loss: 0.5597 - acc: 0.8230
17536/60000 [=======>......................] - ETA: 14s - loss: 0.5547 - acc: 0.8245
17792/60000 [=======>......................] - ETA: 14s - loss: 0.5493 - acc: 0.8262
18048/60000 [========>.....................] - ETA: 13s - loss: 0.5445 - acc: 0.8276
18304/60000 [========>.....................] - ETA: 13s - loss: 0.5400 - acc: 0.8289
18560/60000 [========>.....................] - ETA: 13s - loss: 0.5344 - acc: 0.8307
18816/60000 [========>.....................] - ETA: 13s - loss: 0.5301 - acc: 0.8320
19072/60000 [========>.....................] - ETA: 13s - loss: 0.5274 - acc: 0.8329
19328/60000 [========>.....................] - ETA: 13s - loss: 0.5227 - acc: 0.8343
19584/60000 [========>.....................] - ETA: 12s - loss: 0.5178 - acc: 0.8358
19840/60000 [========>.....................] - ETA: 12s - loss: 0.5142 - acc: 0.8373
20096/60000 [=========>....................] - ETA: 12s - loss: 0.5100 - acc: 0.8387
20352/60000 [=========>....................] - ETA: 12s - loss: 0.5058 - acc: 0.8401
20608/60000 [=========>....................] - ETA: 12s - loss: 0.5015 - acc: 0.8413
20864/60000 [=========>....................] - ETA: 12s - loss: 0.4984 - acc: 0.8424
21120/60000 [=========>....................] - ETA: 12s - loss: 0.4944 - acc: 0.8438
21376/60000 [=========>....................] - ETA: 12s - loss: 0.4899 - acc: 0.8453
21632/60000 [=========>....................] - ETA: 11s - loss: 0.4862 - acc: 0.8464
21888/60000 [=========>....................] - ETA: 11s - loss: 0.4824 - acc: 0.8478
22144/60000 [==========>...................] - ETA: 11s - loss: 0.4793 - acc: 0.8487
22400/60000 [==========>...................] - ETA: 11s - loss: 0.4764 - acc: 0.8497
22656/60000 [==========>...................] - ETA: 11s - loss: 0.4733 - acc: 0.8507
22912/60000 [==========>...................] - ETA: 11s - loss: 0.4700 - acc: 0.8520
23168/60000 [==========>...................] - ETA: 11s - loss: 0.4663 - acc: 0.8533
23424/60000 [==========>...................] - ETA: 11s - loss: 0.4623 - acc: 0.8545
23680/60000 [==========>...................] - ETA: 10s - loss: 0.4592 - acc: 0.8555
23936/60000 [==========>...................] - ETA: 10s - loss: 0.4563 - acc: 0.8565
24192/60000 [===========>..................] - ETA: 10s - loss: 0.4533 - acc: 0.8576
24448/60000 [===========>..................] - ETA: 10s - loss: 0.4498 - acc: 0.8587
24704/60000 [===========>..................] - ETA: 10s - loss: 0.4464 - acc: 0.8598
24960/60000 [===========>..................] - ETA: 10s - loss: 0.4437 - acc: 0.8607
25216/60000 [===========>..................] - ETA: 10s - loss: 0.4418 - acc: 0.8615
25472/60000 [===========>..................] - ETA: 10s - loss: 0.4385 - acc: 0.8625
25728/60000 [===========>..................] - ETA: 10s - loss: 0.4357 - acc: 0.8633
25984/60000 [===========>..................] - ETA: 10s - loss: 0.4337 - acc: 0.8641
26240/60000 [============>.................] - ETA: 9s - loss: 0.4308 - acc: 0.8651
26496/60000 [============>.................] - ETA: 9s - loss: 0.4284 - acc: 0.8658
26752/60000 [============>.................] - ETA: 9s - loss: 0.4255 - acc: 0.8667
27008/60000 [============>.................] - ETA: 9s - loss: 0.4235 - acc: 0.8673
27264/60000 [============>.................] - ETA: 9s - loss: 0.4211 - acc: 0.8680
27520/60000 [============>.................] - ETA: 9s - loss: 0.4189 - acc: 0.8686
27776/60000 [============>.................] - ETA: 9s - loss: 0.4166 - acc: 0.8695
28032/60000 [=============>................] - ETA: 9s - loss: 0.4145 - acc: 0.8700
28288/60000 [=============>................] - ETA: 9s - loss: 0.4120 - acc: 0.8709
28544/60000 [=============>................] - ETA: 9s - loss: 0.4095 - acc: 0.8716
28800/60000 [=============>................] - ETA: 9s - loss: 0.4075 - acc: 0.8723
29056/60000 [=============>................] - ETA: 8s - loss: 0.4060 - acc: 0.8727
29312/60000 [=============>................] - ETA: 8s - loss: 0.4040 - acc: 0.8733
29568/60000 [=============>................] - ETA: 8s - loss: 0.4014 - acc: 0.8741
29824/60000 [=============>................] - ETA: 8s - loss: 0.4000 - acc: 0.8746
30080/60000 [==============>...............] - ETA: 8s - loss: 0.3981 - acc: 0.8753
30336/60000 [==============>...............] - ETA: 8s - loss: 0.3963 - acc: 0.8759
30592/60000 [==============>...............] - ETA: 8s - loss: 0.3941 - acc: 0.8767
30848/60000 [==============>...............] - ETA: 8s - loss: 0.3919 - acc: 0.8775
31104/60000 [==============>...............] - ETA: 8s - loss: 0.3894 - acc: 0.8782
31360/60000 [==============>...............] - ETA: 8s - loss: 0.3874 - acc: 0.8788
31616/60000 [==============>...............] - ETA: 8s - loss: 0.3858 - acc: 0.8793
31872/60000 [==============>...............] - ETA: 7s - loss: 0.3842 - acc: 0.8798
32128/60000 [===============>..............] - ETA: 7s - loss: 0.3821 - acc: 0.8804
32384/60000 [===============>..............] - ETA: 7s - loss: 0.3800 - acc: 0.8810
32640/60000 [===============>..............] - ETA: 7s - loss: 0.3783 - acc: 0.8816
32896/60000 [===============>..............] - ETA: 7s - loss: 0.3771 - acc: 0.8821
33152/60000 [===============>..............] - ETA: 7s - loss: 0.3755 - acc: 0.8826
33408/60000 [===============>..............] - ETA: 7s - loss: 0.3737 - acc: 0.8832
33664/60000 [===============>..............] - ETA: 7s - loss: 0.3717 - acc: 0.8837
33920/60000 [===============>..............] - ETA: 7s - loss: 0.3699 - acc: 0.8843
34176/60000 [================>.............] - ETA: 7s - loss: 0.3685 - acc: 0.8848
34432/60000 [================>.............] - ETA: 7s - loss: 0.3666 - acc: 0.8854
34688/60000 [================>.............] - ETA: 7s - loss: 0.3649 - acc: 0.8860
34944/60000 [================>.............] - ETA: 6s - loss: 0.3633 - acc: 0.8865
35200/60000 [================>.............] - ETA: 6s - loss: 0.3614 - acc: 0.8870
35456/60000 [================>.............] - ETA: 6s - loss: 0.3600 - acc: 0.8875
35712/60000 [================>.............] - ETA: 6s - loss: 0.3583 - acc: 0.8880
35968/60000 [================>.............] - ETA: 6s - loss: 0.3573 - acc: 0.8882
36224/60000 [=================>............] - ETA: 6s - loss: 0.3557 - acc: 0.8887
36480/60000 [=================>............] - ETA: 6s - loss: 0.3541 - acc: 0.8893
36736/60000 [=================>............] - ETA: 6s - loss: 0.3528 - acc: 0.8895
36992/60000 [=================>............] - ETA: 6s - loss: 0.3511 - acc: 0.8901
37248/60000 [=================>............] - ETA: 6s - loss: 0.3492 - acc: 0.8907
37504/60000 [=================>............] - ETA: 6s - loss: 0.3476 - acc: 0.8912
37760/60000 [=================>............] - ETA: 6s - loss: 0.3462 - acc: 0.8917
38016/60000 [==================>...........] - ETA: 5s - loss: 0.3451 - acc: 0.8921
38272/60000 [==================>...........] - ETA: 5s - loss: 0.3437 - acc: 0.8924
38528/60000 [==================>...........] - ETA: 5s - loss: 0.3426 - acc: 0.8928
38784/60000 [==================>...........] - ETA: 5s - loss: 0.3412 - acc: 0.8933
39040/60000 [==================>...........] - ETA: 5s - loss: 0.3398 - acc: 0.8938
39296/60000 [==================>...........] - ETA: 5s - loss: 0.3382 - acc: 0.8942
39552/60000 [==================>...........] - ETA: 5s - loss: 0.3367 - acc: 0.8947
39808/60000 [==================>...........] - ETA: 5s - loss: 0.3358 - acc: 0.8951
40064/60000 [===================>..........] - ETA: 5s - loss: 0.3346 - acc: 0.8955
40320/60000 [===================>..........] - ETA: 5s - loss: 0.3334 - acc: 0.8959
40576/60000 [===================>..........] - ETA: 5s - loss: 0.3322 - acc: 0.8963
40832/60000 [===================>..........] - ETA: 5s - loss: 0.3308 - acc: 0.8968
41088/60000 [===================>..........] - ETA: 5s - loss: 0.3296 - acc: 0.8972
41344/60000 [===================>..........] - ETA: 5s - loss: 0.3287 - acc: 0.8975
41600/60000 [===================>..........] - ETA: 4s - loss: 0.3274 - acc: 0.8980
41856/60000 [===================>..........] - ETA: 4s - loss: 0.3261 - acc: 0.8984
42112/60000 [====================>.........] - ETA: 4s - loss: 0.3248 - acc: 0.8989
42368/60000 [====================>.........] - ETA: 4s - loss: 0.3233 - acc: 0.8994
42624/60000 [====================>.........] - ETA: 4s - loss: 0.3219 - acc: 0.8998
42880/60000 [====================>.........] - ETA: 4s - loss: 0.3208 - acc: 0.9001
43136/60000 [====================>.........] - ETA: 4s - loss: 0.3195 - acc: 0.9005
43392/60000 [====================>.........] - ETA: 4s - loss: 0.3186 - acc: 0.9009
43648/60000 [====================>.........] - ETA: 4s - loss: 0.3173 - acc: 0.9013
43904/60000 [====================>.........] - ETA: 4s - loss: 0.3164 - acc: 0.9015
44160/60000 [=====================>........] - ETA: 4s - loss: 0.3156 - acc: 0.9017
44416/60000 [=====================>........] - ETA: 4s - loss: 0.3143 - acc: 0.9022
44672/60000 [=====================>........] - ETA: 4s - loss: 0.3133 - acc: 0.9025
44928/60000 [=====================>........] - ETA: 4s - loss: 0.3119 - acc: 0.9030
45184/60000 [=====================>........] - ETA: 3s - loss: 0.3109 - acc: 0.9033
45440/60000 [=====================>........] - ETA: 3s - loss: 0.3099 - acc: 0.9036
45696/60000 [=====================>........] - ETA: 3s - loss: 0.3087 - acc: 0.9039
45952/60000 [=====================>........] - ETA: 3s - loss: 0.3077 - acc: 0.9042
46208/60000 [======================>.......] - ETA: 3s - loss: 0.3067 - acc: 0.9045
46464/60000 [======================>.......] - ETA: 3s - loss: 0.3058 - acc: 0.9047
46720/60000 [======================>.......] - ETA: 3s - loss: 0.3047 - acc: 0.9051
46976/60000 [======================>.......] - ETA: 3s - loss: 0.3036 - acc: 0.9054
47232/60000 [======================>.......] - ETA: 3s - loss: 0.3027 - acc: 0.9058
47488/60000 [======================>.......] - ETA: 3s - loss: 0.3016 - acc: 0.9061
47744/60000 [======================>.......] - ETA: 3s - loss: 0.3005 - acc: 0.9065
48000/60000 [=======================>......] - ETA: 3s - loss: 0.2993 - acc: 0.9068
48256/60000 [=======================>......] - ETA: 3s - loss: 0.2990 - acc: 0.9070
48512/60000 [=======================>......] - ETA: 3s - loss: 0.2978 - acc: 0.9074
48768/60000 [=======================>......] - ETA: 2s - loss: 0.2968 - acc: 0.9077
49024/60000 [=======================>......] - ETA: 2s - loss: 0.2957 - acc: 0.9081
49280/60000 [=======================>......] - ETA: 2s - loss: 0.2954 - acc: 0.9082
49536/60000 [=======================>......] - ETA: 2s - loss: 0.2947 - acc: 0.9084
49792/60000 [=======================>......] - ETA: 2s - loss: 0.2938 - acc: 0.9087
50048/60000 [========================>.....] - ETA: 2s - loss: 0.2927 - acc: 0.9091
50304/60000 [========================>.....] - ETA: 2s - loss: 0.2922 - acc: 0.9093
50560/60000 [========================>.....] - ETA: 2s - loss: 0.2911 - acc: 0.9097
50816/60000 [========================>.....] - ETA: 2s - loss: 0.2902 - acc: 0.9100
51072/60000 [========================>.....] - ETA: 2s - loss: 0.2892 - acc: 0.9103
51328/60000 [========================>.....] - ETA: 2s - loss: 0.2885 - acc: 0.9106
51584/60000 [========================>.....] - ETA: 2s - loss: 0.2874 - acc: 0.9109
51840/60000 [========================>.....] - ETA: 2s - loss: 0.2866 - acc: 0.9112
52096/60000 [=========================>....] - ETA: 2s - loss: 0.2856 - acc: 0.9114
52352/60000 [=========================>....] - ETA: 1s - loss: 0.2846 - acc: 0.9118
52608/60000 [=========================>....] - ETA: 1s - loss: 0.2835 - acc: 0.9121
52864/60000 [=========================>....] - ETA: 1s - loss: 0.2826 - acc: 0.9124
53120/60000 [=========================>....] - ETA: 1s - loss: 0.2816 - acc: 0.9127
53376/60000 [=========================>....] - ETA: 1s - loss: 0.2809 - acc: 0.9130
53632/60000 [=========================>....] - ETA: 1s - loss: 0.2801 - acc: 0.9132
53888/60000 [=========================>....] - ETA: 1s - loss: 0.2792 - acc: 0.9134
54144/60000 [==========================>...] - ETA: 1s - loss: 0.2785 - acc: 0.9136
54400/60000 [==========================>...] - ETA: 1s - loss: 0.2774 - acc: 0.9139
54656/60000 [==========================>...] - ETA: 1s - loss: 0.2767 - acc: 0.9142
54912/60000 [==========================>...] - ETA: 1s - loss: 0.2758 - acc: 0.9144
55168/60000 [==========================>...] - ETA: 1s - loss: 0.2754 - acc: 0.9146
55424/60000 [==========================>...] - ETA: 1s - loss: 0.2750 - acc: 0.9148
55680/60000 [==========================>...] - ETA: 1s - loss: 0.2745 - acc: 0.9150
55936/60000 [==========================>...] - ETA: 1s - loss: 0.2738 - acc: 0.9153
56192/60000 [===========================>..] - ETA: 0s - loss: 0.2731 - acc: 0.9155
56448/60000 [===========================>..] - ETA: 0s - loss: 0.2723 - acc: 0.9158
56704/60000 [===========================>..] - ETA: 0s - loss: 0.2719 - acc: 0.9159
56960/60000 [===========================>..] - ETA: 0s - loss: 0.2711 - acc: 0.9161
57216/60000 [===========================>..] - ETA: 0s - loss: 0.2704 - acc: 0.9164
57472/60000 [===========================>..] - ETA: 0s - loss: 0.2696 - acc: 0.9166
57728/60000 [===========================>..] - ETA: 0s - loss: 0.2687 - acc: 0.9169
57984/60000 [===========================>..] - ETA: 0s - loss: 0.2682 - acc: 0.9170
58240/60000 [============================>.] - ETA: 0s - loss: 0.2678 - acc: 0.9172
58496/60000 [============================>.] - ETA: 0s - loss: 0.2671 - acc: 0.9174
58752/60000 [============================>.] - ETA: 0s - loss: 0.2664 - acc: 0.9176
59008/60000 [============================>.] - ETA: 0s - loss: 0.2656 - acc: 0.9179
59264/60000 [============================>.] - ETA: 0s - loss: 0.2654 - acc: 0.9180
59520/60000 [============================>.] - ETA: 0s - loss: 0.2647 - acc: 0.9182
59776/60000 [============================>.] - ETA: 0s - loss: 0.2639 - acc: 0.9184
60000/60000 [==============================] - 16s 265us/step - loss: 0.2633 - acc: 0.9186 - val_loss: 0.0583 - val_acc: 0.9809
Epoch 2/12
128/60000 [..............................] - ETA: 12s - loss: 0.0178 - acc: 0.9922
384/60000 [..............................] - ETA: 12s - loss: 0.0326 - acc: 0.9870
59904/60000 [============================>.] - ETA: 0s - loss: 0.0300 - acc: 0.9907
60000/60000 [==============================] - 14s 235us/step - loss: 0.0299 - acc: 0.9907 - val_loss: 0.0265 - val_acc: 0.9915
Epoch 11/12
128/60000 [..............................] - ETA: 12s - loss: 0.0337 - acc: 0.9922
384/60000 [..............................] - ETA: 12s - loss: 0.0295 - acc: 0.9948
59904/60000 [============================>.] - ETA: 0s - loss: 0.0257 - acc: 0.9918
60000/60000 [==============================] - 13s 213us/step - loss: 0.0257 - acc: 0.9918 - val_loss: 0.0291 - val_acc: 0.9919
Test loss: 0.029070270710035036
Test accuracy: 0.9919
Process finished with exit code 0