1. 安裝 Python 3.6.3
2. 安裝 TensorFlow 及相關的 Python packages
3. 確認 TensorFlow 是否安裝成功pip install --upgrade tensorflow安裝的時候, 我遇到 error message, 提到 python folder 下的 access right 不足, 透過 explorer 設定好 access right 之後 (原本是 read-only, 改為 read-write), 再安裝一次解決了此問題.pip install matplotlibMatplotlib is a Python 2D plotting library.pip install pandaspandas is a Python library providing data structures and data analysis tools.
4. 安裝 gitc:\›python ››› import tensorflow as tf ››› hello = tf.constant('Hello, TensorFlow!') ››› sess = tf.Session()
此時可能會出現如下的 warning message:
它是在提醒安裝的 TensorFlow library 並沒有針對所有的 CPU 延伸指令集做優化, 功能面不會有影響.Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX
››› print(sess.run(hello))
如果出現:
而沒有出現其他錯誤訊息, 表示 TensorFlow 安裝成功了.b'Hello, TensorFlow!'
5. 取得並執行 tutorial sample code 進行 neural network training, 辨識手寫數字
6. 以 5-layer neural network 提高 accuracy 到 97%此 program 以 40 行 Python code, 1-layer neural network 進行手寫數字的辨識, 進行 2000 個 iteration 後, accuracy 可達 92%:c:\›git clone https://github.com/martin-gorner/tensorflow-mnist-tutorial cd tensorflow-mnist-tutorial c:\tensorflow-mnist-tutorial›python mnist_1.0_softmax.py
詳細說明: TensorFlow and deep learning, without a PhD: 6. Lab: let's jump into the code
7. 調整 activation function 及 optimization algorithm, 並進行 learning rate decay, 加快收斂速度及收斂穩定度詳細說明: TensorFlow and deep learning, without a PhD: 7. Lab: adding layersc:\tensorflow-mnist-tutorial›python mnist_2.0_five_layers_sigmoid.py
把 activation function 由 sigmoid 改為 leru, 並且把 optimization algorithm 由 gradient descent 改為 Adam, 並進行 learning rate decay:8. 以 dropout 設法降低 overfitting
詳細說明: TensorFlow and deep learning, without a PhD: 8. Lab: special care for deep networks, 9. Lab: learning rate decayc:\tensorflow-mnist-tutorial›python mnist_2.1_five_layers_relu_lrdecay.py
9. 以 convolutional layers 提升 accuracy 到 98.9%詳細說明: TensorFlow and deep learning, without a PhD: 10. Lab: dropout, overfittingc:\tensorflow-mnist-tutorial›python mnist_2.2_five_layers_relu_lrdecay_dropout.py
10. 增加 convolutional layers output channel 數, 並在 fully connected layer 做 dropout, 提升 accuracy 到 99.3%詳細說明: TensorFlow and deep learning, without a PhD: 12. Lab: a convolutional networkc:\tensorflow-mnist-tutorial›python mnist_3.0_convolutional.py
此 program 以 70 行 Python code, 達到了 99.3% accuracy, 離 MINST 網站公布的世界紀錄 99.7% 只差 0.4%.c:\tensorflow-mnist-tutorial›python mnist_3.1_convolutional_bigger_dropout.py
詳細說明: TensorFlow and deep learning, without a PhD: 13. Lab: the 99% challenge
延伸閱讀
TensorFlow and deep learning, without a PhD
Getting Started with TensorFlow
[學習筆記] 深度學習概述: 核心概念 (Deep Learning: Core Concepts)