notebook 001

notebook 001

INPUTとOUTPUTの個人的な備忘録です。

Raspberry PiにTensorFlowをインストールしてFashion-MNISTのデータを分類モデルで、実行ログ

インストール/実行のログ。参考にしたサイトに掲載されていた手順やプログラムを、そのまま実行した時のログです。
ついでに、MacBook Proで実行したときと実行時間を比較してみました。

(2019年4月実施、ログが出てきたので今更ながら投稿...)


参考にしたサイト

qiita.com

環境

実行内容

環境の確認

pi@raspberrypi:~ $ python -V
Python 2.7.13
pi@raspberrypi:~ $
pi@raspberrypi:~ $ uname -a
Linux raspberrypi 4.14.98-v7+ #1200 SMP Tue Feb 12 20:27:48 GMT 2019 armv7l GNU/Linux
pi@raspberrypi:~ $ python3 -V
Python 3.5.3
pi@raspberrypi:~ $ pip3 -V
pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.5)

ATLASをインストール

pi@raspberrypi:~ $ sudo apt install libatlas-base-dev
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています               
状態情報を読み取っています... 完了
以下の追加パッケージがインストールされます:
  gfortran gfortran-6 libatlas-dev libatlas3-base libblas-dev
  libgfortran-6-dev
提案パッケージ:
  gfortran-doc gfortran-6-doc libgfortran3-dbg libcoarrays-dev libblas-doc
  liblapack-doc liblapack-dev liblapack-doc-man
以下のパッケージが新たにインストールされます:
  gfortran gfortran-6 libatlas-base-dev libatlas-dev libatlas3-base
  libblas-dev libgfortran-6-dev
アップグレード: 0 個、新規インストール: 7 個、削除: 0 個、保留: 0 個。
10.2 MB のアーカイブを取得する必要があります。
この操作後に追加で 48.4 MB のディスク容量が消費されます。
続行しますか? [Y/n] Y
取得:1 http://ftp.tsukuba.wide.ad.jp/Linux/raspbian/raspbian stretch/main armhf libgfortran-6-dev armhf 6.3.0-18+rpi1+deb9u1 [199 kB]
取得:2 http://ftp.tsukuba.wide.ad.jp/Linux/raspbian/raspbian stretch/main armhf gfortran-6 armhf 6.3.0-18+rpi1+deb9u1 [5,421 kB]
取得:3 http://raspbian.raspberrypi.org/raspbian stretch/main armhf gfortran armhf 4:6.3.0-4 [1,352 B]
取得:4 http://ftp.tsukuba.wide.ad.jp/Linux/raspbian/raspbian stretch/main armhf libatlas3-base armhf 3.10.3-1+rpi1 [1,920 kB]
取得:5 http://ftp.tsukuba.wide.ad.jp/Linux/raspbian/raspbian stretch/main armhf libblas-dev armhf 3.7.0-2 [114 kB]
取得:6 http://ftp.tsukuba.wide.ad.jp/Linux/raspbian/raspbian stretch/main armhf libatlas-dev armhf 3.10.3-1+rpi1 [65.9 kB]
取得:7 http://ftp.tsukuba.wide.ad.jp/Linux/raspbian/raspbian stretch/main armhf libatlas-base-dev armhf 3.10.3-1+rpi1 [2,528 kB]
10.2 MB を 5秒 で取得しました (1,823 kB/s)   
以前に未選択のパッケージ libgfortran-6-dev:armhf を選択しています。
(データベースを読み込んでいます ... 現在 80889 個のファイルとディレクトリがインストールされています。)
.../0-libgfortran-6-dev_6.3.0-18+rpi1+deb9u1_armhf.deb を展開する準備をしています ...
libgfortran-6-dev:armhf (6.3.0-18+rpi1+deb9u1) を展開しています...
以前に未選択のパッケージ gfortran-6 を選択しています。
.../1-gfortran-6_6.3.0-18+rpi1+deb9u1_armhf.deb を展開する準備をしています ...
gfortran-6 (6.3.0-18+rpi1+deb9u1) を展開しています...
以前に未選択のパッケージ gfortran を選択しています。
.../2-gfortran_4%3a6.3.0-4_armhf.deb を展開する準備をしています ...
gfortran (4:6.3.0-4) を展開しています...
以前に未選択のパッケージ libatlas3-base を選択しています。
.../3-libatlas3-base_3.10.3-1+rpi1_armhf.deb を展開する準備をしています ...
libatlas3-base (3.10.3-1+rpi1) を展開しています...
以前に未選択のパッケージ libblas-dev を選択しています。
.../4-libblas-dev_3.7.0-2_armhf.deb を展開する準備をしています ...
libblas-dev (3.7.0-2) を展開しています...
以前に未選択のパッケージ libatlas-dev を選択しています。
.../5-libatlas-dev_3.10.3-1+rpi1_armhf.deb を展開する準備をしています ...
libatlas-dev (3.10.3-1+rpi1) を展開しています...
以前に未選択のパッケージ libatlas-base-dev を選択しています。
.../6-libatlas-base-dev_3.10.3-1+rpi1_armhf.deb を展開する準備をしています ...
libatlas-base-dev (3.10.3-1+rpi1) を展開しています...
libatlas3-base (3.10.3-1+rpi1) を設定しています ...
update-alternatives: /usr/lib/libblas.so.3 (libblas.so.3) を提供するために自動モードで /usr/lib/atlas-base/atlas/libblas.so.3 を使います
update-alternatives: /usr/lib/liblapack.so.3 (liblapack.so.3) を提供するために自動モードで /usr/lib/atlas-base/atlas/liblapack.so.3 を使います
libgfortran-6-dev:armhf (6.3.0-18+rpi1+deb9u1) を設定しています ...
libc-bin (2.24-11+deb9u4) のトリガを処理しています ...
man-db (2.7.6.1-2) のトリガを処理しています ...
gfortran-6 (6.3.0-18+rpi1+deb9u1) を設定しています ...
gfortran (4:6.3.0-4) を設定しています ...
update-alternatives: /usr/bin/f95 (f95) を提供するために自動モードで /usr/bin/gfortran を使います
update-alternatives: /usr/bin/f77 (f77) を提供するために自動モードで /usr/bin/gfortran を使います
libblas-dev (3.7.0-2) を設定しています ...
update-alternatives: /usr/lib/libblas.so (libblas.so) を提供するために自動モードで /usr/lib/libblas/libblas.so を使います
libatlas-dev (3.10.3-1+rpi1) を設定しています ...
libatlas-base-dev (3.10.3-1+rpi1) を設定しています ...
update-alternatives: /usr/lib/libblas.so (libblas.so) を提供するために自動モードで /usr/lib/atlas-base/atlas/libblas.so を使います
update-alternatives: /usr/lib/liblapack.so (liblapack.so) を提供するために自動モードで /usr/lib/atlas-base/atlas/liblapack.so を使います
pi@raspberrypi:~ $

TensorFlowをインストール

pi@raspberrypi:~ $ pip3 install tensorflow
Collecting tensorflow
  Downloading https://www.piwheels.org/simple/tensorflow/tensorflow-1.13.1-cp35-none-linux_armv7l.whl (92.5MB)
    100% |████████████████████████████████| 92.5MB 3.7kB/s
Collecting six>=1.10.0 (from tensorflow)
  Downloading https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
Collecting tensorboard<1.14.0,>=1.13.0 (from tensorflow)
  Downloading https://files.pythonhosted.org/packages/0f/39/bdd75b08a6fba41f098b6cb091b9e8c7a80e1b4d679a581a0ccd17b10373/tensorboard-1.13.1-py3-none-any.whl (3.2MB)
    100% |████████████████████████████████| 3.2MB 106kB/s
Collecting termcolor>=1.1.0 (from tensorflow)
  Downloading https://www.piwheels.org/simple/termcolor/termcolor-1.1.0-py3-none-any.whl
Collecting protobuf>=3.6.1 (from tensorflow)
  Downloading https://files.pythonhosted.org/packages/f5/e4/7c86c9c9b4bad7632e107064fb07d0812b9858a49830d0b2477081bf1267/protobuf-3.7.1-py2.py3-none-any.whl (404kB)
    100% |████████████████████████████████| 409kB 750kB/s
Collecting gast>=0.2.0 (from tensorflow)
  Downloading https://www.piwheels.org/simple/gast/gast-0.2.2-py3-none-any.whl
Collecting tensorflow-estimator<1.14.0rc0,>=1.13.0 (from tensorflow)
  Downloading https://files.pythonhosted.org/packages/bb/48/13f49fc3fa0fdf916aa1419013bb8f2ad09674c275b4046d5ee669a46873/tensorflow_estimator-1.13.0-py2.py3-none-any.whl (367kB)
    100% |████████████████████████████████| 368kB 768kB/s
Collecting grpcio>=1.8.6 (from tensorflow)
  Downloading https://files.pythonhosted.org/packages/48/13/571d7a29cec16b45b46af9c4a6145666414a574dbea80e4e4580598de3b4/grpcio-1.20.1-cp35-cp35m-linux_armv7l.whl (10.3MB)
    100% |████████████████████████████████| 10.3MB 32kB/s
Collecting astor>=0.6.0 (from tensorflow)
  Downloading https://files.pythonhosted.org/packages/35/6b/11530768cac581a12952a2aad00e1526b89d242d0b9f59534ef6e6a1752f/astor-0.7.1-py2.py3-none-any.whl
Collecting numpy>=1.13.3 (from tensorflow)
  Downloading https://files.pythonhosted.org/packages/93/48/956b9dcdddfcedb1705839280e02cbfeb2861ed5d7f59241210530867d5b/numpy-1.16.3.zip (5.1MB)
    100% |████████████████████████████████| 5.1MB 67kB/s
Collecting keras-applications>=1.0.6 (from tensorflow)
  Downloading https://files.pythonhosted.org/packages/90/85/64c82949765cfb246bbdaf5aca2d55f400f792655927a017710a78445def/Keras_Applications-1.0.7-py2.py3-none-any.whl (51kB)
    100% |████████████████████████████████| 61kB 1.8MB/s
Collecting wheel>=0.26 (from tensorflow)
  Downloading https://files.pythonhosted.org/packages/96/ba/a4702cbb6a3a485239fbe9525443446203f00771af9ac000fa3ef2788201/wheel-0.33.1-py2.py3-none-any.whl
Collecting keras-preprocessing>=1.0.5 (from tensorflow)
  Downloading https://files.pythonhosted.org/packages/c0/bf/0315ef6a9fd3fc2346e85b0ff1f5f83ca17073f2c31ac719ab2e4da0d4a3/Keras_Preprocessing-1.0.9-py2.py3-none-any.whl (59kB)
    100% |████████████████████████████████| 61kB 1.1MB/s
Collecting absl-py>=0.1.6 (from tensorflow)
  Downloading https://files.pythonhosted.org/packages/da/3f/9b0355080b81b15ba6a9ffcf1f5ea39e307a2778b2f2dc8694724e8abd5b/absl-py-0.7.1.tar.gz (99kB)
    100% |████████████████████████████████| 102kB 1.8MB/s
Collecting werkzeug>=0.11.15 (from tensorboard<1.14.0,>=1.13.0->tensorflow)
  Downloading https://files.pythonhosted.org/packages/18/79/84f02539cc181cdbf5ff5a41b9f52cae870b6f632767e43ba6ac70132e92/Werkzeug-0.15.2-py2.py3-none-any.whl (328kB)
    100% |████████████████████████████████| 337kB 891kB/s
Collecting markdown>=2.6.8 (from tensorboard<1.14.0,>=1.13.0->tensorflow)
  Downloading https://files.pythonhosted.org/packages/f5/e4/d8c18f2555add57ff21bf25af36d827145896a07607486cc79a2aea641af/Markdown-3.1-py2.py3-none-any.whl (87kB)
    100% |████████████████████████████████| 92kB 1.8MB/s
Collecting setuptools (from protobuf>=3.6.1->tensorflow)
  Downloading https://files.pythonhosted.org/packages/ec/51/f45cea425fd5cb0b0380f5b0f048ebc1da5b417e48d304838c02d6288a1e/setuptools-41.0.1-py2.py3-none-any.whl (575kB)
    100% |████████████████████████████████| 583kB 491kB/s
Collecting mock>=2.0.0 (from tensorflow-estimator<1.14.0rc0,>=1.13.0->tensorflow)
  Downloading https://files.pythonhosted.org/packages/e6/35/f187bdf23be87092bd0f1200d43d23076cee4d0dec109f195173fd3ebc79/mock-2.0.0-py2.py3-none-any.whl (56kB)
    100% |████████████████████████████████| 61kB 1.9MB/s
Collecting enum34>=1.0.4 (from grpcio>=1.8.6->tensorflow)
  Downloading https://files.pythonhosted.org/packages/af/42/cb9355df32c69b553e72a2e28daee25d1611d2c0d9c272aa1d34204205b2/enum34-1.1.6-py3-none-any.whl
Collecting futures>=2.2.0 (from grpcio>=1.8.6->tensorflow)
  Downloading https://www.piwheels.org/simple/futures/futures-3.1.1-py3-none-any.whl
Collecting h5py (from keras-applications>=1.0.6->tensorflow)
  Downloading https://www.piwheels.org/simple/h5py/h5py-2.9.0-cp35-cp35m-linux_armv7l.whl (3.5MB)
    100% |████████████████████████████████| 3.5MB 82kB/s
Collecting pbr>=0.11 (from mock>=2.0.0->tensorflow-estimator<1.14.0rc0,>=1.13.0->tensorflow)
  Downloading https://files.pythonhosted.org/packages/07/3e/22d1d35a4b51706ca3590c54359aeb5fa7ea60df46180143a3ea13d45f29/pbr-5.2.0-py2.py3-none-any.whl (107kB)
    100% |████████████████████████████████| 112kB 1.8MB/s
Building wheels for collected packages: numpy, absl-py
  Running setup.py bdist_wheel for numpy ... done
  Stored in directory: /home/pi/.cache/pip/wheels/8c/49/27/48d3f185a57ffcaabdb366bd1d05e86d587222a85de3b48ec2
  Running setup.py bdist_wheel for absl-py ... done
  Stored in directory: /home/pi/.cache/pip/wheels/ee/98/38/46cbcc5a93cfea5492d19c38562691ddb23b940176c14f7b48
Successfully built numpy absl-py
Installing collected packages: six, absl-py, werkzeug, numpy, setuptools, protobuf, wheel, enum34, futures, grpcio, markdown, tensorboard, termcolor, gast, pbr, mock, tensorflow-estimator, astor, h5py, keras-applications, keras-preprocessing, tensorflow
Successfully installed absl-py-0.7.1 astor-0.7.1 enum34-1.1.6 futures-3.1.1 gast-0.2.2 grpcio-1.20.1 h5py-2.9.0 keras-applications-1.0.7 keras-preprocessing-1.0.9 markdown-3.1 mock-2.0.0 numpy-1.16.3 pbr-5.2.0 protobuf-3.7.1 setuptools-41.0.1 six-1.12.0 tensorboard-1.13.1 tensorflow-1.13.1 tensorflow-estimator-1.13.0 termcolor-1.1.0 werkzeug-0.15.2 wheel-0.33.1
pi@raspberrypi:~ $

インストールできたことを確認

pi@raspberrypi:~ $ python3
Python 3.5.3 (default, Sep 27 2018, 17:25:39)
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
/usr/lib/python3.5/importlib/_bootstrap.py:222: RuntimeWarning: compiletime version 3.4 of module 'tensorflow.python.framework.fast_tensor_util' does not match runtime version 3.5
  return f(*args, **kwds)
/usr/lib/python3.5/importlib/_bootstrap.py:222: RuntimeWarning: builtins.type size changed, may indicate binary incompatibility. Expected 432, got 412
  return f(*args, **kwds)
>>> hello = tf.constant('Hello, TensforFlow!')
>>> sess = tf.Session()
>>> print(sess.run(hello))
b'Hello, TensforFlow!'
>>>

Fashion-MNISTのデータを分類モデルで

Raspberry PiにTensorFlowをインストールして基本的な分類サンプル実行まで試した - Qiita

の最後「おまけ」の少し上にある、「ここまでのコードを含めた全体像は次のとおりです。」のコードを fasion.pyとして保存し、実行。

pi@raspberrypi:~/work $ python3 fasion.py
/usr/lib/python3.5/importlib/_bootstrap.py:222: RuntimeWarning: compiletime version 3.4 of module 'tensorflow.python.framework.fast_tensor_util' does not match runtime version 3.5
  return f(*args, **kwds)
/usr/lib/python3.5/importlib/_bootstrap.py:222: RuntimeWarning: builtins.type size changed, may indicate binary incompatibility. Expected 432, got 412
  return f(*args, **kwds)
Traceback (most recent call last):
  File "fasion.py", line 6, in <module>
    import matplotlib.pyplot as plt
ImportError: No module named 'matplotlib'
matplotlibが無かったのでインストール
pi@raspberrypi:~/work $ pip3 install matplotlib
Collecting matplotlib
  Downloading https://files.pythonhosted.org/packages/26/04/8b381d5b166508cc258632b225adbafec49bbe69aa9a4fa1f1b461428313/matplotlib-3.0.3.tar.gz (36.6MB)
    100% |████████████████████████████████| 36.6MB 9.3kB/s
Collecting numpy>=1.10.0 (from matplotlib)
Collecting cycler>=0.10 (from matplotlib)
  Downloading https://files.pythonhosted.org/packages/f7/d2/e07d3ebb2bd7af696440ce7e754c59dd546ffe1bbe732c8ab68b9c834e61/cycler-0.10.0-py2.py3-none-any.whl
Collecting kiwisolver>=1.0.1 (from matplotlib)
  Downloading https://files.pythonhosted.org/packages/16/e7/df58eb8868d183223692d2a62529a594f6414964a3ae93548467b146a24d/kiwisolver-1.1.0.tar.gz
Collecting pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 (from matplotlib)
  Downloading https://files.pythonhosted.org/packages/dd/d9/3ec19e966301a6e25769976999bd7bbe552016f0d32b577dc9d63d2e0c49/pyparsing-2.4.0-py2.py3-none-any.whl (62kB)
    100% |████████████████████████████████| 71kB 2.4MB/s
Collecting python-dateutil>=2.1 (from matplotlib)
  Downloading https://files.pythonhosted.org/packages/41/17/c62faccbfbd163c7f57f3844689e3a78bae1f403648a6afb1d0866d87fbb/python_dateutil-2.8.0-py2.py3-none-any.whl (226kB)
    100% |████████████████████████████████| 235kB 1.2MB/s
Collecting six (from cycler>=0.10->matplotlib)
  Using cached https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
Collecting setuptools (from kiwisolver>=1.0.1->matplotlib)
  Using cached https://files.pythonhosted.org/packages/ec/51/f45cea425fd5cb0b0380f5b0f048ebc1da5b417e48d304838c02d6288a1e/setuptools-41.0.1-py2.py3-none-any.whl
Building wheels for collected packages: matplotlib, kiwisolver
  Running setup.py bdist_wheel for matplotlib ... done
  Stored in directory: /home/pi/.cache/pip/wheels/f7/69/71/df177de59d50adeb7f18fe72dcff609e1add35572ea538f0cb
  Running setup.py bdist_wheel for kiwisolver ... done
  Stored in directory: /home/pi/.cache/pip/wheels/8e/7f/55/25e48fe2e6380060898a949bdd60a6cf507463436eb7144ea5
Successfully built matplotlib kiwisolver
Installing collected packages: numpy, six, cycler, setuptools, kiwisolver, pyparsing, python-dateutil, matplotlib
Successfully installed cycler-0.10.0 kiwisolver-1.1.0 matplotlib-3.0.3 numpy-1.16.3 pyparsing-2.4.0 python-dateutil-2.8.0 setuptools-41.0.1 six-1.12.0
pi@raspberrypi:~/work $

Fashion-MNISTのデータを分類モデルで(学習と、テストデータを使った推論の実行)

pi@raspberrypi:~/work $ python3 fasion.py
/usr/lib/python3.5/importlib/_bootstrap.py:222: RuntimeWarning: compiletime version 3.4 of module 'tensorflow.python.framework.fast_tensor_util' does not match runtime version 3.5
  return f(*args, **kwds)
/usr/lib/python3.5/importlib/_bootstrap.py:222: RuntimeWarning: builtins.type size changed, may indicate binary incompatibility. Expected 432, got 412
  return f(*args, **kwds)
TensorFlow 1.13.1
Loading Fashion MNIST dataset...Downloading data from https://storage.googleapis.com/tensorflow/tf-keras-datasets/train-labels-idx1-ubyte.gz
32768/29515 [=================================] - 0s 1us/step
Downloading data from https://storage.googleapis.com/tensorflow/tf-keras-datasets/train-images-idx3-ubyte.gz
26427392/26421880 [==============================] - 20s 1us/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 [==============================] - 2s 1us/step
done
 - Training dataset, images: (60000, 28, 28), labels: 60000
 - Test dataset, images: (10000, 28, 28), labels: 10000
WARNING:tensorflow:From /home/pi/.local/lib/python3.5/site-packages/tensorflow/python/ops/resource_variable_ops.py:435: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version.
Instructions for updating:
Colocations handled automatically by placer.
Epoch 1/5
60000/60000 [==============================] - 24s 398us/sample - loss: 0.4993 - acc: 0.8250
Epoch 2/5
60000/60000 [==============================] - 23s 379us/sample - loss: 0.3763 - acc: 0.8646
Epoch 3/5
60000/60000 [==============================] - 24s 394us/sample - loss: 0.3409 - acc: 0.8762
Epoch 4/5
60000/60000 [==============================] - 24s 406us/sample - loss: 0.3142 - acc: 0.8828
Epoch 5/5
60000/60000 [==============================] - 25s 411us/sample - loss: 0.2968 - acc: 0.8906
10000/10000 [==============================] - 2s 222us/sample - loss: 0.3466 - acc: 0.8711
test loss 0.34661070029735563, test accuracy 0.8711
predictions[0] : [9.8518658e-06 1.0928159e-06 6.1005852e-07 4.4801538e-07 1.6527849e-06
 9.8732645e-03 1.3108089e-06 4.0091708e-02 1.5393305e-05 9.5000392e-01]
np.argmax(predictions[0]) : 9
test_labels[0] : 9
pi@raspberrypi:~/work $

実行時間部分を抜粋

Raspberry Pi 3 Model B+

  • Train: 1エポック(60000枚)の学習に、24秒
  • Test: 1枚の推論には、0.2ms (222 マイクロ秒)
Epoch 1/5
60000/60000 [==============================] - 24s 398us/sample - loss: 0.4993 - acc: 0.8250
Epoch 2/5
60000/60000 [==============================] - 23s 379us/sample - loss: 0.3763 - acc: 0.8646
Epoch 3/5
60000/60000 [==============================] - 24s 394us/sample - loss: 0.3409 - acc: 0.8762
Epoch 4/5
60000/60000 [==============================] - 24s 406us/sample - loss: 0.3142 - acc: 0.8828
Epoch 5/5
60000/60000 [==============================] - 25s 411us/sample - loss: 0.2968 - acc: 0.8906
10000/10000 [==============================] - 2s 222us/sample - loss: 0.3466 - acc: 0.8711
test loss 0.34661070029735563, test accuracy 0.8711

参考:MacBook Pro

  • Train: 1エポック(60000枚)の学習に、2秒
  • Test: 1枚の推論には、0.02ms (20 マイクロ秒)
Epoch 1/5
2019-04-28 00:41:09.392192: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
60000/60000 [==============================] - 2s 36us/step - loss: 0.4993 - acc: 0.8240
Epoch 2/5
60000/60000 [==============================] - 2s 32us/step - loss: 0.3784 - acc: 0.8624
Epoch 3/5
60000/60000 [==============================] - 2s 32us/step - loss: 0.3342 - acc: 0.8786
Epoch 4/5
60000/60000 [==============================] - 2s 32us/step - loss: 0.3104 - acc: 0.8861
Epoch 5/5
60000/60000 [==============================] - 2s 32us/step - loss: 0.2942 - acc: 0.8908
10000/10000 [==============================] - 0s 20us/step
test loss 0.3590170142173767, test accuracy 0.8724