图解翻译和详解深度学习GAN(含项目完整代码)翻译自:
https://github.com/jonbruner/generative-adversarial-networks
单词表
GAN(generative adversarial networks),生成对抗网络
generative,adj.生殖的;能生产的,有生产力的详情点击跳转
Adversarial,adj.敌手的,对手的,对抗(性)的详情点击跳转
repository,n.仓库;贮藏室;博物馆;亲信
O'Reilly Media,Inc.是世界上在UNIX、X、Internet和其他开放系统图书领域具有领导地位的出版公司,同时是联机出版的先锋。从最畅销的《The Whole Internet User's Guide & Catalog》(被纽约公共图书馆评为二十世纪最重要的50本书之一)到GNN(最早的Internet门户和商业网站),再到WebSite(第一个桌面PC的Web服务器软件),O'Reilly Meida,Inc.一直处于Internet发展的最前沿。
cell-by-cell,逐步的,一点一点的。
GAN起源
Generative Adversarial Networks(arxiv:https://arxiv.org/abs/1406.2661),2014年,Ian Goodfellow(当时在蒙特利尔读博士)的提出。
蒙特利尔大学,是加拿大名列前茅的综合性大学,该校建立于1878年,如今已有130年的历史。近几年来,学校各种学术研究成果在全加拿大综合排名第二。
GAN的架构
GAN包含两个模型:生成模型(GM,Generative Model)和判别模型(DM,Discriminative Model)。
TensorFlow,是 Google多年以来内部的机器学习系统。2015年11月9日,Google发布人工智能系统TensorFlow并宣布开源。官网 中文教程 中文介绍
TensorFlow™ 是一个采用数据流图(data flow graphs),用于数值计算的开源软件库。节点(Nodes)在图中表示数学操作,图中的线(edges)则表示在节点间相互联系的多维数据数组,即张量(tensor)。
GAN介绍
Introduction to generative adversarial networks
生成对抗网络(GAN)介绍
This repository contains code to accompany the O'Reilly tutorial on generative adversarial networks written by Jon Bruner and Adit Deshpande. See the original tutorial to run this code in a pre-built environment on O'Reilly's servers with cell-by-cell guidance, or run these files on your own machine.
这个库包含了由Jon Bruner和Adit Deshpande根据O'Reilly生成对抗网络的教程编写的代码。学习原创教程时,可以在O'Reilly的服务器上,基于已经建立的环境逐步运行这些代码(有助于理解和学习),或在自己的机器上运行这些代码。
There are three versions of our simple GAN model in this repository:
该库中,有三个简单的GAN 模型的版本(gan-notebook.ipynb、gan-script.py、gan-script-fast.py)。
gan-notebook.ipynb is identical to the interactive tutorial, available here so that you can run it on your own machine.
gan-notebook.ipynb是一个交互式训练教程,可以在计算机上运行,方便学习体验。
gan-script.py is a straightforward Python script containing code drawn directly from the tutorial, to be run from the command line. Note that it doesn't print anything when it's executed, but it does send regular updates to TensorBoard so that you can track its progress.
gan-script.py是一个简单的Python文件,该代码来自教程,可以在命令行运行。请注意,(程序运行时)它不打印出任何东西,但它将定期更新到tensorboard,方便可以跟踪其进展。
gan-script-fast.py is a modest refactoring of gan-script.py that runs slightly faster because more of its computations are contained in the TensorFlow graph.
gan-script-fast.py是一个基于gan-script.py的适当的重构,运行速度稍快,因为更多的计算都包含在TensorFlow图中。
Requirements and installation
要求和安装
In order to run gan-script.py or gan-script-fast.py, you'll need TensorFlow version 1.0 or later and NumPy. In order to run gan-notebook.ipynb, you'll additionally need Jupyter and matplotlib.
请基于TensorFlow 1.0及以上版本和NumPy运行gan-script.py或gan-script-fast.py,运行gan-notebook.ipynb,额外还需要jupyter和matplotlib库。
If you've already got TensorFlow on your machine, then you've got NumPy and should be able to run the raw Python scripts.
如果你的电脑已经部署TensorFlow,那么请部署NumPy方便运行最新的Python脚本。
Installing Anaconda Python and TensorFlow
安装Anaconda Python 和TensorFlow
The easiest way to install TensorFlow as well as NumPy, Jupyter, and matplotlib is to start with the Anaconda Python distribution.
安装TensorFlow 、NumPy, Jupyter和matplotlib最简单的方法是安装Anaconda Python环境。
1. Follow the installation instructions for Anaconda Python. We recommend using Python 3.
根据Anaconda Python安装指南,请使用Python3.
2. Follow the platform-specific TensorFlow installation instructions. Be sure to follow the "Installing with Anaconda" process, and create a Conda environment named tensorflow.
根据TensorFlow安装指南的平台特征,我们根据"Installing with Anaconda"说明,创建Conda环境并命名为tensorflow。
3. If you aren't still inside your Conda TensorFlow environment, enter it by opening your terminal and typing
source activate tensorflow
如果没有在Conda TensorFlow环境,请打开终端(cmd或Anaconda Prompt)输入指令
source activate tensorflow
4. Download and unzip this entire repository from GitHub, either interactively, or by entering
git clone https://github.com/jonbruner/generative-adversarial-networks.git
下载和解压 this entire repository from GitHub文件(点击链接),或者输入以下指令获取(基于linux等环境较多)
git clone https://github.com/jonbruner/generative-adversarial-networks.git
5. Use cd to navigate into the top directory of the repo on your machine
使用cd(命令行语言)导航到电脑上本代码库的一级目录。
举例:下载本代码库并解压到C盘generative-adversarial-networks-master文件夹下,在cmd中输入
cd c:\generative-adversarial-networks-master
6. Launch Jupyter by entering
jupyter notebook
通过输入以下指令启动Jupyter
jupyter notebook
and, using your browser, navigate to the URL shown in the terminal output (usuallyhttp://localhost:8888/)
随后,使用用浏览器,导航到终端显示(输入jupyter notebook指令,浏览器会自动打开并显示http://localhost:8888/),地址栏URL一般是http://localhost:8888/。