这是使用 TensorFlow 实现流行的机器学习算法的教程汇集。本汇集的目标是让读者可以轻松通过案例深入 TensorFlow。

这些案例适合那些想要清晰简明的 TensorFlow 实现案例的初学者。本教程还包含了笔记和带有注解的代码。

  • 项目地址:https://github.com/aymericdamien/TensorFlow-Examples

教程索引

0 - 先决条件

机器学习入门:

  • 笔记: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

1 - 入门

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

2 - 基本模型

最近邻:

  • 笔记: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

3 - 神经网络

多层感知器:

  • 笔记: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

4 - 实用技术

保存和恢复模型

  • 笔记: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 - 多 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

数据集

一些案例需要 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/

更多案例

接下来的示例来自 TFLearn,这是一个为 TensorFlow 提供了简化的接口的库。你可以看看,这里有很多示例和预构建的运算和层。

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

  • 预构建的运算和层:http://tflearn.org/doc_index/#api

教程

TFLearn 快速入门。通过一个具体的机器学习任务学习 TFLearn 基础。开发和训练一个深度神经网络分类器。

  • 笔记: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) (https://github.com/tflearn/tflearn/blob/master/examples/images/residual_network_mnist.py).。应用于 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

其他

Recommender-Wide&Deep Network,推荐系统中 wide & deep 网络的教学示例:https://github.com/tflearn/tflearn/blob/master/examples/others/recommender_wide_and_deep.py

Notebooks

  • Spiral Classification Problem,对斯坦福 CS231n spiral 分类难题的 TFLearn 实现:https://github.com/tflearn/tflearn/blob/master/examples/notebooks/spiral.ipynb

可延展的 TensorFlow

  • 层,与 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

数十种TensorFlow实现案例汇集:代码+笔记相关推荐

  1. TensorFlow实现案例汇集:代码+笔记

    这是使用 TensorFlow 实现流行的机器学习算法的教程汇集.本汇集的目标是让读者可以轻松通过案例深入 TensorFlow. 这些案例适合那些想要清晰简明的 TensorFlow 实现案例的初学 ...

  2. 深度学习框架tensorflow学习与应用——代码笔记11(未完成)

    11-1 第十周作业-验证码识别(未完成) #!/usr/bin/env python # coding: utf-8# In[1]:import os import tensorflow as tf ...

  3. TF学习:Tensorflow基础案例、经典案例集合——基于python编程代码的实现

    TF学习:Tensorflow基础案例.经典案例集合--基于python编程代码的实现 目录 Tensorflow的使用入门 1.TF:使用Tensorflow输出一句话 2.TF实现加法 3.TF实 ...

  4. Transformer课程 第8课NER案例代码笔记-IOB标记

    Transformer课程 第8课NER案例代码笔记-IOB标记 NER Tags and IOB Format 训练集和测试集都是包含餐厅相关文本(主要是评论和查询)的单个文件,其中每个单词都有一个 ...

  5. Transformer课程 第8课NER案例代码笔记-部署简介

    Transformer课程 第8课NER案例代码笔记 BERT微调器 NER是信息提取的子任务,旨在将非结构化文本中提到的命名实体定位并分类为预定义类别,如人名.组织.位置.医疗代码.时间表达式.数量 ...

  6. 《数亦有道》配套代码云端迁移进展

    在之前的 一篇文章 里,我给你分享了翟羽佳老师上传到百度飞桨 AI Studio 的 <数亦有道> 配套代码. 当时的迁移,可以让你及时下载书中的配套代码.但其实,我们还有更高的预期,就是 ...

  7. OpenCV4经典案例实战教程 笔记

    OpenCV4经典案例实战教程 笔记 这几天在看OpenCV4经典的案例实战教程,这里记录一下学习的过程. 案例一 刀片1的缺陷检测 这里的目的是检测出有缺陷的刀片,如下图. 先总结一下思路,这里首先 ...

  8. 机器翻译 Transformer代码笔记

    (未完) Transformer论文及框架分析:机器翻译Transformer框架分析笔记 | Attention is all you need 本文代码来源Github:kyubyong/tran ...

  9. 联邦学习算法介绍-FedAvg详细案例-Python代码获取

    联邦学习算法介绍-FedAvg详细案例-Python代码获取 一.联邦学习系统框架 二.联邦平均算法(FedAvg) 三.联邦随梯度下降算法 (FedSGD) 四.差分隐私随联邦梯度下降算法 (DP- ...

最新文章

  1. 机房收费系统(VB.NET)——超具体的报表制作过程
  2. 中国的自动驾驶到底发展到了什么程度?
  3. 设置ListView每条数据之间的间隔
  4. OpenCV中的waitkey()详解
  5. php连接MYSQL(1)
  6. linux下改变python的版本
  7. 阿里P8架构师谈:MySQL行锁、表锁、悲观锁、乐观锁的特点与应用
  8. android gone动画_Android动画之淡入淡出
  9. Algorithm:贪心策略之区间覆盖问题
  10. oracle 表字段顺序_如何更改Oracle数据库表中字段顺序
  11. java rtmp录制视频_red5-rtmp-push
  12. android-常用布局-三
  13. eval同时绑定两个值:通过String.Format给超链接中的两个参数赋值
  14. 【优化求解】基于matlab罚函数的粒子群算法函数寻优【含Matlab源码 216期】
  15. Linux一句话精彩问答-网络无关篇
  16. 推荐电影 梦工厂经典电影列表 1996-2012
  17. html5 楼盘效果图,楼盘效果图图集
  18. 硬盘数据恢复原理与方法
  19. word中输入空格变点
  20. php yii2 ddd,Xunsearch SDK for PHP/yii2

热门文章

  1. linux修改ftp锁定目录,解决linux下ftp指定访问目录无法修改的问题
  2. linux笔记之 vi编辑器和用户的配置文件及提权
  3. java mysql乱码_41、java与mysql乱码的问题
  4. 无法安装php-fpm,PHP编译安装后无法启动PHP-FPM
  5. pcm 8k单声道和双声道采样_音频接口PCM
  6. php考试倒计时提交系统,AJAX_基于Ajax技术实现考试倒计时并自动提交试卷,1.概述在开发网络考试系统 - phpStudy...
  7. 微型计算机的三级存储体系是,简述存储系统的三级存储体系及分级的目的。
  8. linux中postscript如何生成,【转载】如何为Linux生成和打上patch
  9. linux文件的定义变量的值,linux shell 自定义函数方法(定义、返回值、变量作用域)...
  10. 取消myeclipse2017的Dashboard页面