Hvass-Labs / TensorFlow-Tutorials-Chinese

TensorFlow 中文教程 (Chinese Tutorials)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TensorFlow 中文教程 (Chinese Tutorials)

GitHub原始仓库: 中文 / 英文

原作者 Magnus Erik Hvass Pedersen

中文翻译 thrillerist / ZhouGeorge

介绍

  • 这份教程适用于深度学习和TensorFlow的初学者。
  • 每个教程包含一个主题。
  • 提供了完整的源代码。
  • 每个教程有对应的视频YouTube video.

教程

  1. 简单的线性模型 (Notebook) (Google Colab)

  2. 卷积神经网络 (Notebook) (Google Colab)

3-C. Keras API (Notebook) (Google Colab)

  1. 保存 & 恢复 (Notebook) (Google Colab)

  2. 集成学习 (Notebook) (Google Colab)

  3. CIFAR-10 (Notebook) (Google Colab)

  4. Inception 模型 (Notebook) (Google Colab)

  5. 迁移学习 (Notebook) (Google Colab)

  6. 视频数据 (Notebook) (Google Colab)

  7. Fine-Tuning (Notebook) (Google Colab)

  8. 对抗样本 (Notebook) (Google Colab)

  9. MNIST的对抗样本 (Notebook) (Google Colab)

  10. 可视化分析 (Notebook) (Google Colab)

13-B. MNIST可视化分析 (Notebook) (Google Colab)

  1. DeepDream (Notebook) (Google Colab)

  2. 风格迁移 (Notebook) (Google Colab)

  3. 强化学习 (Notebook) (Google Colab)

  4. Estimator API (Notebook) (Google Colab)

  5. TFRecords & Dataset API (Notebook) (Google Colab)

  6. 超参数优化 (Notebook) (Google Colab)

  7. 自然语言处理 (Notebook) (Google Colab)

  8. 机器翻译 (Notebook) (Google Colab)

  9. 图像描述 (Notebook) (Google Colab)

  10. 时间序列描述 (Notebook) (Google Colab)

视频

视频资源YouTube videos.

被淘汰的教程

一些教程使用了PrettyTensor来创建神经网络的,但是PrettyTensor API现在已经被淘汰了。一些Notebooks也因此被废弃了,它们已经在上面被标记出来。 所以我们建议你在TensorFlow中使用Keras API来创建神经网络。

Forks

请参阅forks 以便对这些教程进行社区修改。

下载

一些Python Notebooks使用的源码被放置在不同的文件夹下,这是为了能更方便的允许跨教程使用。 因此建议你从GitHub上下载整个仓库,而不是下载独立的Python NoteBooks。

Git

最简单的方式下载和安置这些教程是通过命令行中使用git:

git clone https://github.com/Hvass-Labs/TensorFlow-Tutorials-Chinese.git

这将创建一个目录 TensorFlow-Tutorials-Chinese 并将所有的文件下载进去。

这也使得更新教程变得更加容易,通过在该目录中执行这个命令:

git pull

Zip-File

你也可以下载 GitHub仓库中的内容的zip文件并且手动释放它。

配置

安装和运行TensorFlow的方法有很多。这章节描述了我是如何做到的。 可能你希望通过不同的方式来完成,那么你可以自己去互联网上搜索指令。

如果你刚接触Python和Linux等。那么让它工作起来是很具有挑战性的 并且你可能需要对各种错误消息进行网络搜索,等等。 通过下面的练习可以让过程变得容易。

Python版本大于3.5

这些教程在Linx上开发,使用了Python 3.5 / 3.6 ( Anaconda) 和 PyCharm.

在Python 2.7下运行教程会报错。请确保你使用Python 3.5或更高。

配置环境

安装完 Anaconda之后, 你需要创建一个 conda environment 那样你不会破坏你的主要的配置,以防你在某个地方出错:

conda create --name tf python=3

当Python更新到一个新的版本时,TensorFlow更新到新Python版本之前可能需要一段时间。 所以如果TensorFlow安装失败了,那么你可能需要为你的新环境指定一个较老的Python版本,例如:

conda create --name tf python=3.6

现在你可以通过运行下面的指令来切换到新的环境(Linux):

source activate tf

需要的程序包

在这份教程中需要安装一些Python的程序包。这是清单 requirements.txt 首先,你需要编辑这个文件并选择你想要的是CPU还是GPU版本的TensorFlow。

为了安装这些Python程序包,你首先要确保你激活了之前创建的conda-environment(上一步中提到),然后在终端里运行西面的命令:

pip install -r requirements.txt

注意TensorFlow的GPU版本还需要安装NVIDIA的各种驱动,这里没有提到。

如何运行

如果你遵循了上面的安装说明,你现在应该可以在Python Notebooks上运行这份教程了:

cd ~/development/TensorFlow-Tutorials-Chinese/  # Your installation directory.
jupyter notebook

它会打开网页浏览器并显示所有教程的清单。这时你可以点击加载一份具体的教程。

在Google Colab上运行

如果你不想在你的计算机上安装任何东西,你可以在网络上浏览,编辑和运行这些Notebooks通过 Google Colab. 这是一个 YouTube 视频 解释如何使用。

点击"Google Colab"链接(在上面清单的每一个教程旁边),你可以在Colab上浏览这个Notebook ,但是你需要登陆你的Google账号才能运行它。

然后你需要在Notebook的顶部执行下面的命令,它会将仓库里的内容复制到你Colab上的工作目录中。

import os
work_dir = "/content/TensorFlow-Tutorials-Chinese/"
if os.getcwd() != work_dir:
    !git clone https://github.com/Hvass-Labs/TensorFlow-Tutorials-Chinese.git
os.chdir(work_dir)

所有需要的程序包应该已经在Colab上被安装好,否则你可以运行下面的命令:

!pip install -r requirements.txt

旧版本

有些时候源码被改变了,与YouTube视频中不一样。这可能是由于修复Bug,改进, 或因为代码段被移动到单独的文件中,以方便重用。

如果你想要看YouTube视频中对应的代码,那么你可以浏览GitHub的提交历史

License (MIT)

These tutorials and source-code are published under the MIT License which allows very broad use for both academic and commercial purposes.

A few of the images used for demonstration purposes may be under copyright. These images are included under the "fair usage" laws.

You are very welcome to modify these tutorials and use them in your own projects. Please keep a link to the original repository.

About

TensorFlow 中文教程 (Chinese Tutorials)

License:MIT License


Languages

Language:Jupyter Notebook 99.4%Language:Python 0.6%