• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TwoStageVAE: two-stage VAE model proposed in our ICLR 2019 paper "Diagnoisi ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

TwoStageVAE

开源软件地址:

https://gitee.com/daib13/TwoStageVAE

开源软件介绍:

TwoStageVAE

This is the code for the two-stage VAE model proposed in our ICLR 2019 paper "Diagnoising and Enhancing VAE Models" [1].

[1] Dai, B. and Wipf, D. Diagnosing and enhancing VAE models. In International Conference on Learning Representations, 2019.

Step 1. Prepare Dataset

We do experiments on MNIST, Fashion-MNIST, Cifar-10 and CelebA dataset. These data are downloaded from the official website and then transformed to npy format using preprocess.py script. Follow the next steps to prepare each dataset. Or you can directly download the data from Google Doc. (If you directly download the data from Google Doc, extract the file to the root folder.)

MNIST

Download the data from: http://yann.lecun.com/exdb/mnist/

You will get the files t10k-images-idx3-ubyte, t10k-labels-idx1-ubyte, train-images-idx3-ubyte, train-labels-idx1-ubyte. Put them in the folder ./data/mnist.

Fashion-MNIST

Download the data from: https://github.com/zalandoresearch/fashion-mnist

Again you will get four files t10k-images-idx3-ubyte, t10k-labels-idx1-ubyte, train-images-idx3-ubyte, train-labels-idx1-ubyte. Put them in the folder ./data/fashion.

To preprocess MNIST and Fashion-MNIST, you also need to install the package python-mnist by

pip install python-mnist

Cifar-10

Download the data (python version) from: https://www.cs.toronto.edu/~kriz/cifar.html

Extract the downloaded file in ./data/cifar10. There will be one sub-folder called cifar-10-batches-py. Inside this folder, there will be 6 files named data_batch_1, data_batch_2, data_batch_3, data_batch_4, data_batch_5 and test_batch.

CelebA Dataset

Download the data from: http://mmlab.ie.cuhk.edu.hk/projects/CelebA.html

Put the extracted images files (202599 jpg files) in the folder ./data/celeba/img_align_celeba.

Preprocess

Transform the data into .npy format by running the command

python preprocess.py

You will obtain some .npy files in each subfolder under ./data.

Step 2. Run Two-Stage VAE

Train the model by running

python demo.py --dataset [DATASET] --network-structure [NETWORK] --exp-name [EXP] --gpu [GPU]

The argument --exp-name allows you to set up your experiemnt ID. It will make a folder ./experiments/[DATASET]/[EXP] to put all the output files and images. If you only want to test the model, add --val in the command line.

  • Datasets: Use lowercases. You can select from: mnist, fashion, cifar10 and celeba.
  • Network structure: You can select from Infogan, Wae and Resnet. To implement your own network structures, you can add a new derived class of TwoStageVaeModel in ./network/two_stage_vae_model.py and just implement the build_encoder1 and build_decoder1 functions.
  • Cross entropy loss: If you want to run the experiments with cross entropy loss (VAE(cross-entr.) method in the paper), you can add --cross-entropy-loss in the command line.

Generated samples

To reproduce the following results with Resnet architecture, run

python demo.py --dataset celeba --epochs 100 --lr-epochs 40 --epochs2 100 --lr-epochs2 40 --network-structure Resnet --num-scale 4 --base-dim 32 --latent-dim 128 --gpu [GPU] --exp-name [EXP]
  • Random samples generated by the first stage VAE using Resnet structure on CelebA:

Resnet 1st stage

  • Random samples generated by the second stage VAE using Resnet structure on CelebA:

Resnet 2nd stage

To reproduce the following results with WAE architecture, run

python dome.py --dataset celeba --epochs 70 --lr-epochs 30 --epochs2 70 --lr-epochs2 30 --network-structure Wae --gpu [GPU] --exp-name [EXP]
  • Random samples generated by the first stage VAE using WAE network structure on CelebA:

WAE 1st stage

  • Random samples generated by the second stage VAE using WAE network structure on CelebA:

WAE 2nd stage


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
SMG: 强人工智能系统。发布时间:2022-03-24
下一篇:
HyperFT: 移动端快速视频人脸跟踪-移动端150FPS+ http://www.zeusee.com ...发布时间:2022-03-24
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap