Non-engineer memoblog

エンジニアではない人間のメモブログ(備忘録とアウトプット欲のために)

Windows/Mac環境によるTensorFlowの動作テスト

Windows環境によるTensorFlowの動作テスト

参考にさせていただいた記事

yaju3d.hatenablog.jp

qiita.com

Download and Setup  |  TensorFlow


以下を実行

pip install --upgrade https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-0.12.0rc0-cp35-cp35m-win_amd64.whl  

エラー

Collecting tensorflow-gpu==0.12.0rc0 from https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-0.12.0rc0-cp35-cp35m-win_amd64.whl
Downloading https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-0.12.0rc0-cp35-cp35m-win_amd64.whl (32.5MB)
100% |################################| 32.5MB 32kB/s
Requirement already up-to-date: wheel>=0.26 in c:\users\owner\anaconda3\lib\site-packages (from tensorflow-gpu==0.12.0rc0)
Requirement already up-to-date: protobuf==3.1.0 in c:\users\owner\anaconda3\lib\site-packages (from tensorflow-gpu==0.12.0rc0)
Requirement already up-to-date: six>=1.10.0 in c:\users\owner\anaconda3\lib\site-packages (from tensorflow-gpu==0.12.0rc0)
Requirement already up-to-date: numpy>=1.11.0 in c:\users\owner\anaconda3\lib\site-packages (from tensorflow-gpu==0.12.0rc0)
Collecting setuptools (from protobuf==3.1.0->tensorflow-gpu==0.12.0rc0)
Using cached setuptools-31.0.0-py2.py3-none-any.whl
Installing collected packages: tensorflow-gpu, setuptools
Found existing installation: tensorflow-gpu 0.12.0rc0
Uninstalling tensorflow-gpu-0.12.0rc0:
Successfully uninstalled tensorflow-gpu-0.12.0rc0
Found existing installation: setuptools 23.0.0
Cannot remove entries from nonexistent file c:\users\owner\anaconda3\lib\site-packages\easy-install.pth

以下を参考にエラー対応
h-piiice16.hatenablog.com


記事中引用

調べてみるとsetuptoolsがコンフリクトしているのが問題らしくconda removeでsetuptoolsをリムーブすれば大丈夫かと思いいろいろ試行錯誤してみたもののうまく行かず…

とありましたが、そのままremoveでとりあえず動作。

Successfully installed setuptools-31.0.0 tensorflow-gpu-0.12.0rc0

インストール完了。


MNISTチュートリアルWindows CPU実行)

参考にさせていただいた記事

TensorFlow : ML 初心者向けの MNIST (コード解説) – TensorFlow

PyCharm上で実行

Successfully downloaded train-images-idx3-ubyte.gz 9912422 bytes.
Extracting /tmp/data/train-images-idx3-ubyte.gz

・・・・・・・・・・・・

0.9172

91%の精度(90%くらいだと精度が悪いようです)。

WARNING:tensorflow:From ...in <module>.: initialize_all_variables (from tensorflow.python.ops.variables) is deprecated and will be removed after 2017-03-02.
Instructions for updating:
Use `tf.global_variables_initializer` instead.

※今年の3月までに変数初期化命令を global_variables_initializer に変える必要があり(以下参考)。

qiita.com

一応Mac上でも動作確認(Jupyter Notebook上で実行)

今度はWindowsGPU環境でMNISTのExpertsをテスト(Jupyter Notebook上で実行)


結果は99.2%(計算には2分かからないくらい)。

step 400以降はずっと96%~100%を行ったり来たり。step 8700で94%になってしまいましたが、その後は安定して98%前後でした。