[教程]一份简单易懂的 TensorFlow 教程
上周分享了一份 TensorFlow 官方的中文版教程,這次分享的是在 Github 上的一份簡單易懂的教程,項目地址是:
https://github.com/open-source-for-science/TensorFlow-Course#why-use-tensorflow
如下圖所示,已經(jīng)有超過7000的 Star了
這個倉庫的目標是提供一份簡單且容易上手的 TensorFlow 教程,每個教程都包含源代碼,并且大部分都包含有一份文檔。
目錄
- 什么是 TensorFlow?
- 動機
- 為什么要使用 TensorFlow?
- TensorFlow 的安裝和環(huán)境配置
- TensorFlow 教程
- 熱身
- 基礎(chǔ)知識
- 機器學(xué)習(xí)基礎(chǔ)
- 神經(jīng)網(wǎng)絡(luò)
- 一些有用的教程
什么是 TensorFlow?
TensorFlow 是一個用于多任務(wù)數(shù)據(jù)流編程的開源軟件庫。它是一個符號數(shù)學(xué)庫,同時也能應(yīng)用在如神經(jīng)網(wǎng)絡(luò)方面的機器學(xué)習(xí)應(yīng)用。它在谷歌可以同時應(yīng)用在研究和工程中。
TensorFlow 是谷歌大腦團隊開發(fā)出來作為谷歌內(nèi)部使用的。它在2015年9月份公布出來,并采用 Apache 2.0 開源協(xié)議。
目前最新的穩(wěn)定版本是 2018年9月27日的1.11.0版本。
動機
開始這個開源項目的動機有很多。TensorFlow 是目前可用的最好的深度學(xué)習(xí)框架之一,所以應(yīng)該問的是現(xiàn)在網(wǎng)上能找到這么多關(guān)于 TensorFlow 教程,為什么還需要創(chuàng)建這個開源項目呢?
為什么要使用 TensorFlow?
深度學(xué)習(xí)現(xiàn)在是非常的火,并且現(xiàn)在也有快速和優(yōu)化實現(xiàn)算法和網(wǎng)絡(luò)結(jié)構(gòu)的需求。而 TensorFlow 就是為了幫助實現(xiàn)這個目標而設(shè)計出來的。
TensorFlow 的亮點就在于它可以非常靈活的設(shè)計模塊化的模型,但是這對于初學(xué)者是一個缺點,因為這意味著需要考慮很多東西才能建立一個模型。
當(dāng)然,上述問題因為有很多高級的 API 接口,如 Keras(https://keras.io/) 和 Slim(https://github.com/tensorflow/models/blob/031a5a4ab41170d555bc3e8f8545cf9c8e3f1b28/research/inception/inception/slim/README.md) 等通過抽象機器學(xué)習(xí)算法中的許多模塊的軟件庫而得到較好的解決。
對于 TensorFlow 來說,一件非常有趣的事情就是現(xiàn)在到處都可以找到它的身影。大量的研究者和開發(fā)者都在使用它,而且它的社區(qū)正以光速的速度發(fā)展起來。所以很多問題都可以輕松解決,因為在它的社區(qū)中有非常多的人都在使用,大部分人都會遇到相同的問題。
TensorFlow 的安裝和環(huán)境配置
TensorFlow 的安裝和環(huán)境配置可以如下面動圖所示,按照這個教程:https://github.com/open-source-for-science/TensorFlow-Course/blob/master/docs/tutorials/installation 操作即可。
這里主要推薦的是采用虛擬環(huán)境安裝的方式,一是可以避免安裝庫沖突的問題,特別是因為 python 的版本問題;第二個是可以自定義工作環(huán)境,針對 python 的 2.x 版本 和 3.x 版本分別設(shè)置不同的虛擬環(huán)境,安裝不同的軟件庫。
TensorFlow 教程
接下來就是本教程的主要內(nèi)容了,大部分的教程都包含了文檔的說明,所有的教程都有代碼和用 Jupyter notebook 編寫的代碼,也就是 Ipython。
熱身
入門的代碼:https://github.com/open-source-for-science/TensorFlow-Course/blob/master/codes/python/0-welcome
IPython 形式:https://github.com/open-source-for-science/TensorFlow-Course/blob/master/codes/ipython/0-welcome/code/0-welcome.ipynb
文檔介紹:https://github.com/open-source-for-science/TensorFlow-Course/blob/master/docs/tutorials/0-welcome
基礎(chǔ)
基礎(chǔ)的數(shù)學(xué)運算
文檔介紹:https://github.com/open-source-for-science/TensorFlow-Course/tree/master/docs/tutorials/1-basics/basic_math_operations
代碼:https://github.com/open-source-for-science/TensorFlow-Course/blob/master/codes/python/1-basics/basic_math_operations
Ipython:https://github.com/open-source-for-science/TensorFlow-Course/blob/master/codes/ipython/1-basics/basic_math_operations/code/basic_math_operation.ipynb
TensorFlow 變量介紹
文檔介紹:https://github.com/open-source-for-science/TensorFlow-Course/blob/master/docs/tutorials/1-basics/variables
代碼:https://github.com/open-source-for-science/TensorFlow-Course/blob/master/codes/python/1-basics/variables/README.rst
Ipython:https://github.com/open-source-for-science/TensorFlow-Course/blob/master/codes/ipython/1-basics/variables/code/variables.ipynb
機器學(xué)習(xí)基礎(chǔ)
線性回歸
文檔介紹:https://github.com/open-source-for-science/TensorFlow-Course/blob/master/docs/tutorials/2-basics_in_machine_learning/linear_regression
代碼:https://github.com/open-source-for-science/TensorFlow-Course/tree/master/codes/python/2-basics_in_machine_learning/linear_regression
Ipython:https://github.com/open-source-for-science/TensorFlow-Course/blob/master/codes/ipython/2-basics_in_machine_learning/linear_regression/code/linear_regression.ipynb
邏輯回歸
文檔說明:https://github.com/open-source-for-science/TensorFlow-Course/blob/master/docs/tutorials/2-basics_in_machine_learning/logistic_regression
代碼:https://github.com/open-source-for-science/TensorFlow-Course/blob/master/codes/python/2-basics_in_machine_learning/logistic_regression
Ipython:https://github.com/open-source-for-science/TensorFlow-Course/blob/master/codes/ipython/2-basics_in_machine_learning/logistic_regression/code/logistic_regression.ipynb
線性支持向量機
代碼:https://github.com/open-source-for-science/TensorFlow-Course/blob/master/codes/python/2-basics_in_machine_learning/linear_svm
Ipython:https://github.com/open-source-for-science/TensorFlow-Course/blob/master/codes/ipython/2-basics_in_machine_learning/linear_svm/code/linear_svm.ipynb
多類核支持向量機
代碼:https://github.com/open-source-for-science/TensorFlow-Course/blob/master/codes/python/2-basics_in_machine_learning/multiclass_svm
Ipython:https://github.com/open-source-for-science/TensorFlow-Course/blob/master/codes/ipython/2-basics_in_machine_learning/multiclass_svm/code/multiclass_svm.ipynb
神經(jīng)網(wǎng)絡(luò)
多層感知器
代碼:https://github.com/open-source-for-science/TensorFlow-Course/blob/master/codes/python/3-neural_networks/multi-layer-perceptron
Ipython:https://github.com/open-source-for-science/TensorFlow-Course/blob/master/codes/ipython/3-neural_networks/multi-layer-perceptron/code/train_mlp.ipynb
卷積神經(jīng)網(wǎng)絡(luò)
文檔介紹:https://github.com/open-source-for-science/TensorFlow-Course/blob/master/docs/tutorials/3-neural_network/convolutiona_neural_network
代碼:https://github.com/open-source-for-science/TensorFlow-Course/tree/master/codes/python/3-neural_networks/convolutional-neural-network
循環(huán)神經(jīng)網(wǎng)絡(luò)
代碼:https://github.com/open-source-for-science/TensorFlow-Course/blob/master/codes/python/3-neural_networks/recurrent-neural-networks/code/rnn.py
Ipython:https://github.com/open-source-for-science/TensorFlow-Course/blob/master/codes/ipython/3-neural_networks/recurrent-neural-networks/code/rnn.ipynb
其他有用的教程
- TensorFlow Examples–適合初學(xué)者的教程和代碼例子
https://github.com/aymericdamien/TensorFlow-Examples - Sungjoon’s TensorFlow-101–采用 Jupyter Notebook 編寫的教程
https://github.com/sjchoi86/Tensorflow-101 - Terry Um’s TensorFlow Exercises–根據(jù)其他 TensorFlow 例子重新編寫的代碼
https://github.com/terryum/TensorFlow_Exercises - Classification on time series–采用 TensorFlow 實現(xiàn)的 LSTM 的循環(huán)神經(jīng)網(wǎng)絡(luò)分類代碼
https://github.com/guillaume-chevalier/LSTM-Human-Activity-Recognition
這就是本次分享的 TensorFlow 教程,后面我也會繼續(xù)分享對這個教程的學(xué)習(xí)筆記和翻譯。
歡迎關(guān)注我的微信公眾號–機器學(xué)習(xí)與計算機視覺或者掃描下方的二維碼,在后臺留言,和我分享你的建議和看法,指正文章中可能存在的錯誤,大家一起交流,學(xué)習(xí)和進步!
我的個人博客:
http://ccc013.github.io/
推薦閱讀
1.機器學(xué)習(xí)入門系列(1)–機器學(xué)習(xí)概覽(上)
2.機器學(xué)習(xí)入門系列(2)–機器學(xué)習(xí)概覽(下)
3.[GAN學(xué)習(xí)系列] 初識GAN
4.[GAN學(xué)習(xí)系列2] GAN的起源
5.谷歌開源的 GAN 庫–TFGAN
創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎勵來咯,堅持創(chuàng)作打卡瓜分現(xiàn)金大獎總結(jié)
以上是生活随笔為你收集整理的[教程]一份简单易懂的 TensorFlow 教程的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 收集最优雅的8条编程最佳指导语录
- 下一篇: 后端:Layui实现文件上传功能