首页
学习
活动
专区
圈层
工具
发布
社区首页 >专栏 >学习语义特征理解世界-InfoGAN代码复现

学习语义特征理解世界-InfoGAN代码复现

作者头像
CreateAMind
发布2018-07-20 16:13:55
发布2018-07-20 16:13:55
9560
举报
文章被收录于专栏:CreateAMindCreateAMind

我们之前介绍了INFOGAN,今天运行代码复现效果。

InfoGAN

Code for reproducing key results in the paper InfoGAN: Interpretable Representation Learning by Information Maximizing Generative Adversarial Nets by Xi Chen, Yan Duan, Rein Houthooft, John Schulman, Ilya Sutskever, Pieter Abbeel.

Dependencies

This project currently requires the dev version of TensorFlow available on Github:https://github.com/tensorflow/tensorflow. As of the release, the latest commit is 79174a.

In addition, please pip install the following packages:

  • prettytensor
  • progressbar
  • python-dateutil

Running in Docker

代码语言:javascript
复制
$ git clone git@github.com:openai/InfoGAN.git
$ docker run -v $(pwd)/InfoGAN:/InfoGAN -w /InfoGAN -it -p 8888:8888 gcr.io/tensorflow/tensorflow:r0.9rc0-devel
root@X:/InfoGAN# pip install -r requirements.txt
root@X:/InfoGAN# python launchers/run_mnist_exp.py

Running Experiment

We provide the source code to run the MNIST example:

代码语言:javascript
复制
PYTHONPATH='.' python launchers/run_mnist_exp.py

You can launch TensorBoard to view the generated images:

代码语言:javascript
复制
tensorboard --logdir logs/mnist

我们直接使用文档的docker运行方法:

docker 安装参考: https://docs.docker.com/engine/installation/linux/ubuntulinux/#install

docker运行的秘钥运行前命令配置:

export DOCKER_OPTS="-H $DOCKER_HOST --tls --tlskey $DOCKER_CERT_PATH/server-key.pem --tlscert $DOCKER_CERT_PATH/server.pem --tlsverify --tlscacert $DOCKER_CERT_PATH/ca.pem "

alias docker="docker $DOCKER_OPTS "

docker run -v $(pwd)/a.InfoGAN:/a.InfoGAN -w /a.InfoGAN -it -p 8888:8888 gcr.io/tensorflow/tensorflow:r0.9rc0-devel 这一步如果为首次运行则会下载docker镜像然后运行进入镜像ssh终端。

原论文和程序中,mnist训练参数设置为10个类别的数字分类,和两个连续隐变量,测试中这两个隐变量分别学到了旋转和宽度特征

我们在配置中单独增加了另外两个连续变量,如下:

latent_spec = [

(Uniform(62), False),

(Categorical(10), True),

(Uniform(1, fix_std=True), True),

(Uniform(1, fix_std=True), True),

(Uniform(1, fix_std=True), True), #新加

(Uniform(1, fix_std=True), True), #新加

] 然后进行测试,看看程序能学到什么特征?

2 训练结果两个隐变量和4个隐变量的可视化对比:

第一行为10个分类,第二行为连续隐变量,

第三行是 第二个隐变量;第四行为新加的第一个隐变量

第五行为新加的第二个隐变量。

发现什么新特征了吗?

本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2016-09-06,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 CreateAMind 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • InfoGAN
    • Dependencies
    • Running in Docker
    • Running Experiment
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档