當前位置:
首頁 > 知識 > 乾貨 | TensorFlow的55個經典案例

乾貨 | TensorFlow的55個經典案例


微信公眾號


關鍵字全網搜索最新排名


【機器學習演算法】:排名第一


【機器學習】:排名第二


【Python】:排名第三


【演算法】:排名第四


轉自1024深度學習





導語:

本文是TensorFlow實現流行機器學習演算法的教程彙集,

目標是讓讀者可以輕鬆通過

清晰簡明的

案例深入了解 TensorFlow。

這些案例

適合那些想要

實現一些

TensorFlow

案例

的初學者。本教程包含還包含筆記和帶有註解的代碼。

第一步:給TF新手的教程指南





1:tf初學者需要明白的入門準備





  • 機器學習入門

    筆記:



https://github.com/aymericdamien/TensorFlow-Examples/blob/master/notebooks/0_Prerequisite/ml_introduction.ipynb




  • MNIST 數據集入門筆記



https://github.com/aymericdamien/TensorFlow-Examples/blob/master/notebooks/0_Prerequisite/mnist_dataset_intro.ipynb




2:

tf初學者需要了解的

入門基礎






  • Hello World



https://github.com/aymericdamien/TensorFlow-Examples/blob/master/notebooks/1_Introduction/helloworld.ipynb


https://github.com/aymericdamien/TensorFlow-Examples/blob/master/examples/1_Introduction/helloworld.py






  • 基本操作



https://github.com/aymericdamien/TensorFlow-Examples/blob/master/notebooks/1_Introduction/basic_operations.ipynb


https://github.com/aymericdamien/TensorFlow-Examples/blob/master/examples/1_Introduction/basic_operations.py




3:tf初學者需要掌握

的基本模型






  • 最近鄰:



https://github.com/aymericdamien/TensorFlow-Examples/blob/master/notebooks/2_BasicModels/nearest_neighbor.ipynb


https://github.com/aymericdamien/TensorFlow-Examples/blob/master/examples/2_BasicModels/nearest_neighbor.py






  • 線性回歸:



https://github.com/aymericdamien/TensorFlow-Examples/blob/master/notebooks/2_BasicModels/linear_regression.ipynb


https://github.com/aymericdamien/TensorFlow-Examples/blob/master/examples/2_BasicModels/linear_regression.py






  • Logistic 回歸:



https://github.com/aymericdamien/TensorFlow-Examples/blob/master/notebooks/2_BasicModels/logistic_regression.ipynb


https://github.com/aymericdamien/TensorFlow-Examples/blob/master/examples/2_BasicModels/logistic_regression.py




4:tf初學者需要嘗試的神經網路






  • 多層感知器:



https://github.com/aymericdamien/TensorFlow-Examples/blob/master/notebooks/3_NeuralNetworks/multilayer_perceptron.ipynb


https://github.com/aymericdamien/TensorFlow-Examples/blob/master/examples/3_NeuralNetworks/multilayer_perceptron.py






  • 卷積神經網路:



https://github.com/aymericdamien/TensorFlow-Examples/blob/master/notebooks/3_NeuralNetworks/convolutional_network.ipynb


https://github.com/aymericdamien/TensorFlow-Examples/blob/master/examples/3_NeuralNetworks/convolutional_network.py






  • 循環神經網路(LSTM):



https://github.com/aymericdamien/TensorFlow-Examples/blob/master/notebooks/3_NeuralNetworks/recurrent_network.ipynb


https://github.com/aymericdamien/TensorFlow-Examples/blob/master/examples/3_NeuralNetworks/recurrent_network.py






  • 雙向循環神經網路(LSTM):



https://github.com/aymericdamien/TensorFlow-Examples/blob/master/notebooks/3_NeuralNetworks/bidirectional_rnn.ipynb


https://github.com/aymericdamien/TensorFlow-Examples/blob/master/examples/3_NeuralNetworks/bidirectional_rnn.py






  • 動態循環神經網路(LSTM)



https://github.com/aymericdamien/TensorFlow-Examples/blob/master/examples/3_NeuralNetworks/dynamic_rnn.py






  • 自編碼器



https://github.com/aymericdamien/TensorFlow-Examples/blob/master/notebooks/3_NeuralNetworks/autoencoder.ipynb


https://github.com/aymericdamien/TensorFlow-Examples/blob/master/examples/3_NeuralNetworks/autoencoder.py




5:tf初學者需要精通的實用技術






  • 保存和恢復模型



https://github.com/aymericdamien/TensorFlow-Examples/blob/master/notebooks/4_Utils/save_restore_model.ipynb


https://github.com/aymericdamien/TensorFlow-Examples/blob/master/examples/4_Utils/save_restore_model.py






  • 圖和損失可視化



https://github.com/aymericdamien/TensorFlow-Examples/blob/master/notebooks/4_Utils/tensorboard_basic.ipynb


https://github.com/aymericdamien/TensorFlow-Examples/blob/master/examples/4_Utils/tensorboard_basic.py






  • Tensorboard——高級可視化



https://github.com/aymericdamien/TensorFlow-Examples/blob/master/examples/4_Utils/tensorboard_advanced.py




5:t

f初學者需要的懂得的多GPU基本操作






  • 多 GPU 上的基本操作



https://github.com/aymericdamien/TensorFlow-Examples/blob/master/notebooks/5_MultiGPU/multigpu_basics.ipynb


https://github.com/aymericdamien/TensorFlow-Examples/blob/master/examples/5_MultiGPU/multigpu_basics.py




6:案例需要的數據集




有一些案例需要 MNIST 數據集進行訓練和測試。運行這些案例時,該數據集會被自動下載下來(使用 input_data.py)。



MNIST數據集筆記

:https://github.com/aymericdamien/TensorFlow-Examples/blob/master/notebooks/0_Prerequisite/mnist_dataset_intro.ipynb


官方網站:http://yann.lecun.com/exdb/mnist/




第二步:為TF新手

備的各個類型的案例、模型和數據集




初步了解:TFLearn

TensorFlow


接下來的示例來自TFLearn,這是一個為 TensorFlow 提供了簡化的介面的庫。裡面有很多示例和預構建的運算和層。


使用教程

:TFLearn 快速入門。通過一個具體的機器學習任務學習 TFLearn 基礎。開發和訓練一個深度神經網路分類器。



TFLearn地址:https://github.com/tflearn/tflearn


示例:https://github.com/tflearn/tflearn/tree/master/examples


預構建的運算和層:http://tflearn.org/doc_index/#api



筆記:https://github.com/tflearn/tflearn/blob/master/tutorials/intro/quickstart.md




基礎模型以及數據集






  • 線性回歸,使用 TFLearn 實現線性回歸



https://github.com/tflearn/tflearn/blob/master/examples/basics/linear_regression.py




  • 邏輯運算符。使用 TFLearn 實現邏輯運算符



https://github.com/tflearn/tflearn/blob/master/examples/basics/logical.py




  • 權重保持。保存和還原一個模型



https://github.com/tflearn/tflearn/blob/master/examples/basics/weights_persistence.py




  • 微調。在一個新任務上微調一個預訓練的模型



https://github.com/tflearn/tflearn/blob/master/examples/basics/finetuning.py




  • 使用 HDF5。使用 HDF5 處理大型數據集



https://github.com/tflearn/tflearn/blob/master/examples/basics/use_hdf5.py




  • 使用 DASK。使用 DASK 處理大型數據集



https://github.com/tflearn/tflearn/blob/master/examples/basics/use_dask.py




計算機視覺模型及數據集






  • 多層感知器。一種用於 MNIST 分類任務的多層感知實現



https://github.com/tflearn/tflearn/blob/master/examples/images/dnn.py




  • 卷積網路(MNIST)。用於分類 MNIST 數據集的一種卷積神經網路實現



https://github.com/tflearn/tflearn/blob/master/examples/images/convnet_mnist.py




  • 卷積網路(CIFAR-10)。用於分類 CIFAR-10 數據集的一種卷積神經網路實現



https://github.com/tflearn/tflearn/blob/master/examples/images/convnet_cifar10.py




  • 網路中的網路。用於分類 CIFAR-10 數據集的 Network in Network 實現



https://github.com/tflearn/tflearn/blob/master/examples/images/network_in_network.py




  • Alexnet。將 Alexnet 應用於 Oxford Flowers 17 分類任務



https://github.com/tflearn/tflearn/blob/master/examples/images/alexnet.py




  • VGGNet。將 VGGNet 應用於 Oxford Flowers 17 分類任務



https://github.com/tflearn/tflearn/blob/master/examples/images/vgg_network.py




  • VGGNet Finetuning (Fast Training)。使用一個預訓練的 VGG 網路並將其約束到你自己的數據上,以便實現快速訓練



https://github.com/tflearn/tflearn/blob/master/examples/images/vgg_network_finetuning.py




  • RNN Pixels。使用 RNN(在像素的序列上)分類圖像



https://github.com/tflearn/tflearn/blob/master/examples/images/rnn_pixels.py




  • Highway Network。用於分類 MNIST 數據集的 Highway Network 實現



https://github.com/tflearn/tflearn/blob/master/examples/images/highway_dnn.py




  • Highway Convolutional Network。用於分類 MNIST 數據集的 Highway Convolutional Network 實現



https://github.com/tflearn/tflearn/blob/master/examples/images/convnet_highway_mnist.py




  • Residual Network (MNIST) 。應用於 MNIST 分類任務的一種瓶頸殘差網路(bottleneck residual network)



https://github.com/tflearn/tflearn/blob/master/examples/images/residual_network_mnist.py




  • Residual Network (CIFAR-10)。應用於 CIFAR-10 分類任務的一種殘差網路



https://github.com/tflearn/tflearn/blob/master/examples/images/residual_network_cifar10.py




  • Google Inception(v3)。應用於 Oxford Flowers 17 分類任務的谷歌 Inception v3 網路



https://github.com/tflearn/tflearn/blob/master/examples/images/googlenet.py




  • 自編碼器。用於 MNIST 手寫數字的自編碼器



https://github.com/tflearn/tflearn/blob/master/examples/images/autoencoder.py




自然語言處理模型及數據集






  • 循環神經網路(LSTM),應用 LSTM 到 IMDB 情感數據集分類任



https://github.com/tflearn/tflearn/blob/master/examples/nlp/lstm.py




  • 雙向 RNN(LSTM),將一個雙向 LSTM 應用到 IMDB 情感數據集分類任務:



https://github.com/tflearn/tflearn/blob/master/examples/nlp/bidirectional_lstm.py




  • 動態 RNN(LSTM),利用動態 LSTM 從 IMDB 數據集分類可變長度文本:



https://github.com/tflearn/tflearn/blob/master/examples/nlp/dynamic_lstm.py




  • 城市名稱生成,使用 LSTM 網路生成新的美國城市名:



https://github.com/tflearn/tflearn/blob/master/examples/nlp/lstm_generator_cityname.py




  • 莎士比亞手稿生成,使用 LSTM 網路生成新的莎士比亞手稿:



https://github.com/tflearn/tflearn/blob/master/examples/nlp/lstm_generator_shakespeare.py




  • Seq2seq,seq2seq 循環網路的教學示例:



https://github.com/tflearn/tflearn/blob/master/examples/nlp/seq2seq_

example.py




  • CNN Seq,應用一個 1-D 卷積網路從 IMDB 情感數據集中分類詞序列



https://github.com/tflearn/tflearn/blob/master/examples/nlp/cnn_sentence_classification.py




強化學習案例






  • Atari Pacman 1-step Q-Learning,使用 1-step Q-learning 教一台機器玩 Atari 遊戲:



https://github.com/tflearn/tflearn/blob/master/examples/reinforcement_learning/atari_1step_qlearning.py




第三步:為TF新手準備的其他方面內容






  • Recommender-Wide&Deep Network,推薦系統中 wide & deep 網路的教學示例:



https://github.com/tflearn/tflearn/blob/master/examples/others/recommender_wide_and_deep.py




  • Spiral Classification Problem,對斯坦福 CS231n spiral 分類難題的 TFLearn 實現:



https://github.com/tflearn/tflearn/blob/master/examples/notebooks/spiral.ipynb




  • 層,與 TensorFlow 一起使用 TFLearn 層:



https://github.com/tflearn/tflearn/blob/master/examples/extending_tensorflow/layers.py




  • 訓練器,使用 TFLearn 訓練器類訓練任何 TensorFlow 圖:



https://github.com/tflearn/tflearn/blob/master/examples/extending_tensorflow/layers.py




  • Bulit-in Ops,連同 TensorFlow 使用 TFLearn built-in 操作:



https://github.com/tflearn/tflearn/blob/master/examples/extending_tensorflow/builtin_ops.py




  • Summaries,連同 TensorFlow 使用 TFLearn summarizers:



https://github.com/tflearn/tflearn/blob/master/examples/extending_tensorflow/summaries.py




  • Variables,連同 TensorFlow 使用 TFLearn Variables:



https://github.com/tflearn/tflearn/blob/master/examples/extending_tensorflow/variables.py


投稿、商業合作


請發郵件到:357062955@qq.com




喜歡,別忘關注~


幫助你在AI領域更好的發展,期待與你相遇!

喜歡這篇文章嗎?立刻分享出去讓更多人知道吧!

本站內容充實豐富,博大精深,小編精選每日熱門資訊,隨時更新,點擊「搶先收到最新資訊」瀏覽吧!

TAG: |

您可能感興趣

New Balance 為經典 574 推出 Swarovski 水晶定製版本
Bell & Ross Heritage懷舊經典系列BR V2-92 和 BR V2-94 Steel Heritage腕錶
Grand Seiko復刻腕錶榮獲Watchstars Awards「2018年經典之星」獎項
再現榮耀:Grand Seiko SBGW253復刻經典榮獲國際腕錶大獎 Classic Star 2018
Nike 復刻 1993 年經典跑鞋 Outburst
Marvel Studios成立10周年誌慶 HT推出1:4 MK3經典人偶
《Polyroll》上線Steam 經典90年代風格的橫版佳
經典重塑,NikeAirMax93OG全新配色「DustyCactus」
經典重塑,Nike Air Max 93 OG 全新配色「Dusty Cactus」
致敬經典!AJ3 All-Star「Dunk Series」
經典新裝,Nike Air Max 98 全新配色「Thunder Blue」
致一代經典Nike Air Jordan 1
不朽經典 商務傳奇 ThinkPad X1 Carbon 2018
重塑經典!Air Jordan 1 Rebel 「Top3」 最新實拍圖曝光
經典傳承 NIKE Air Force 1 「Hong Kong」 近賞
超經典口號-Nike Air Max 1「Just Do It」30 周年紀念版
Reebok 為經典鞋款 Classic Leather 推出全新 Ultraknit 版本
Champion 控告街頭品牌 Hudson Outerwear 侵犯經典 Logo 版權
Ron Herman x Ralph Lauren 經典服飾單品 20 種配色壓境
Nokia 重新復刻《The Matrix》中的經典下滑蓋手機 8110