Google がオープンソース化した人工知能ライブラリ Tensorflow のインストールとサンプル実行

Google、人工知能ライブラリ TensorFlow をオープンソース化。音声検索や写真認識、翻訳の基盤技術ディープラーニングを商利用可で解放
http://japanese.engadget.com/2015/11/09/google-tensorflow/
でました。

Mac 環境へのインストール

brew install python
pip install https://storage.googleapis.com/tensorflow/mac/tensorflow-0.5.0-py2-none-any.whl

MNIST のサンプル実行

MNIST は大量の学習サンプル、テストサンプルからなる手書き数字画像データベースです。
ディープラーニングで活用されています。

git clone --recurse-submodules https://github.com/tensorflow/tensorflow
cd tensorflow/
python tensorflow/models/image/mnist/convolutional.py

これでサンプル実行できます。
MNISTの手書きの数字ファイルを取得して、学習が始まります。

Succesfully downloaded train-images-idx3-ubyte.gz 9912422 bytes.
Succesfully downloaded train-labels-idx1-ubyte.gz 28881 bytes.
Succesfully downloaded t10k-images-idx3-ubyte.gz 1648877 bytes.
Succesfully downloaded t10k-labels-idx1-ubyte.gz 4542 bytes.
Extracting data/train-images-idx3-ubyte.gz
Extracting data/train-labels-idx1-ubyte.gz
Extracting data/t10k-images-idx3-ubyte.gz
Extracting data/t10k-labels-idx1-ubyte.gz
can't determine number of CPU cores: assuming 4
I tensorflow/core/common_runtime/local_device.cc:25] Local device intra op parallelism threads: 4
can't determine number of CPU cores: assuming 4
I tensorflow/core/common_runtime/local_session.cc:45] Local session inter op parallelism threads: 4
Initialized!
Epoch 0.00
Minibatch loss: 12.054, learning rate: 0.010000
Minibatch error: 90.6%
Validation error: 84.6%
Epoch 0.12
Minibatch loss: 3.282, learning rate: 0.010000
Minibatch error: 4.7%
Validation error: 7.0%
Epoch 0.23
Minibatch loss: 3.490, learning rate: 0.010000
Minibatch error: 12.5%
Validation error: 3.8%
Epoch 0.35
Minibatch loss: 3.197, learning rate: 0.010000
Minibatch error: 6.2%
Validation error: 3.2%
Epoch 0.47
Minibatch loss: 3.215, learning rate: 0.010000
Minibatch error: 6.2%
Validation error: 2.8%
Epoch 0.58
Minibatch loss: 3.295, learning rate: 0.010000
Minibatch error: 7.8%
Validation error: 2.7%
Epoch 0.70
Minibatch loss: 3.191, learning rate: 0.010000
Minibatch error: 6.2%
Validation error: 2.6%
Epoch 0.81
Minibatch loss: 3.014, learning rate: 0.010000
Minibatch error: 3.1%
Validation error: 2.4%
Epoch 0.93
Minibatch loss: 3.122, learning rate: 0.010000
Minibatch error: 9.4%
Validation error: 2.0%
Epoch 1.05
Minibatch loss: 2.930, learning rate: 0.009500
Minibatch error: 3.1%
Validation error: 1.6%
Epoch 1.16
Minibatch loss: 2.853, learning rate: 0.009500
Minibatch error: 0.0%
Validation error: 1.6%
Epoch 1.28
Minibatch loss: 2.820, learning rate: 0.009500
Minibatch error: 0.0%
Validation error: 1.5%
Epoch 1.40
Minibatch loss: 2.887, learning rate: 0.009500
Minibatch error: 4.7%
Validation error: 1.5%
Epoch 1.51
Minibatch loss: 2.764, learning rate: 0.009500
Minibatch error: 0.0%
Validation error: 1.7%
Epoch 1.63
Minibatch loss: 2.779, learning rate: 0.009500
Minibatch error: 1.6%
Validation error: 1.5%
Epoch 1.75
Minibatch loss: 2.871, learning rate: 0.009500
Minibatch error: 6.2%
Validation error: 1.2%
Epoch 1.86
Minibatch loss: 2.692, learning rate: 0.009500
Minibatch error: 0.0%
Validation error: 1.4%
Epoch 1.98
Minibatch loss: 2.649, learning rate: 0.009500
Minibatch error: 0.0%
Validation error: 1.4%
Epoch 2.09
Minibatch loss: 2.662, learning rate: 0.009025
Minibatch error: 1.6%
Validation error: 1.4%
Epoch 2.21
Minibatch loss: 2.640, learning rate: 0.009025
Minibatch error: 1.6%
Validation error: 1.2%
Epoch 2.33
Minibatch loss: 2.632, learning rate: 0.009025
Minibatch error: 3.1%
Validation error: 1.3%
Epoch 2.44
Minibatch loss: 2.572, learning rate: 0.009025
Minibatch error: 0.0%
Validation error: 1.2%
Epoch 2.56
Minibatch loss: 2.569, learning rate: 0.009025
Minibatch error: 0.0%
Validation error: 1.3%
Epoch 2.68
Minibatch loss: 2.546, learning rate: 0.009025
Minibatch error: 1.6%
Validation error: 1.2%
Epoch 2.79
Minibatch loss: 2.498, learning rate: 0.009025
Minibatch error: 0.0%
Validation error: 1.1%
Epoch 2.91
Minibatch loss: 2.480, learning rate: 0.009025
Minibatch error: 0.0%
Validation error: 1.2%
Epoch 3.03
Minibatch loss: 2.457, learning rate: 0.008574
Minibatch error: 0.0%
Validation error: 1.1%
Epoch 3.14
Minibatch loss: 2.479, learning rate: 0.008574
Minibatch error: 1.6%
Validation error: 1.0%
Epoch 3.26
Minibatch loss: 2.429, learning rate: 0.008574
Minibatch error: 1.6%
Validation error: 1.2%
Epoch 3.37
Minibatch loss: 2.439, learning rate: 0.008574
Minibatch error: 4.7%
Validation error: 1.2%
Epoch 3.49
Minibatch loss: 2.402, learning rate: 0.008574
Minibatch error: 1.6%
Validation error: 1.1%
Epoch 3.61
Minibatch loss: 2.405, learning rate: 0.008574
Minibatch error: 3.1%
Validation error: 1.1%
Epoch 3.72
Minibatch loss: 2.328, learning rate: 0.008574
Minibatch error: 0.0%
Validation error: 1.2%
Epoch 3.84
Minibatch loss: 2.316, learning rate: 0.008574
Minibatch error: 0.0%
Validation error: 1.1%
Epoch 3.96
Minibatch loss: 2.301, learning rate: 0.008574
Minibatch error: 0.0%
Validation error: 1.1%
Epoch 4.07
Minibatch loss: 2.274, learning rate: 0.008145
Minibatch error: 0.0%
Validation error: 1.1%
Epoch 4.19
Minibatch loss: 2.261, learning rate: 0.008145
Minibatch error: 0.0%
Validation error: 1.0%
Epoch 4.31
Minibatch loss: 2.238, learning rate: 0.008145
Minibatch error: 0.0%
Validation error: 1.0%

学習が進んでますね!