One-sixth / CVAE-GAN_tensorlayer

A CVAE-GAN implementation with tensorlayer1.x
21 stars 11 forks source link

CVAE-GAN_tensorlayer

A CVAE-GAN implementation with tensorlayer.

Examples

training VAE output

0_0 0_1600 1_1600 3_600

testing VAE output and Recon output

0 1 2 3

Dependent

tensorflow
tensorlayer
numpy
progressbar2

My test environment is tensorflow-gpu-1.10, tensorlayer-1.91, gtx970m-3g.

Some Problem and Attention

emmm... This implementation may have some differences with the page.
I try WGAN-GP and LS-GAN 's loss, but the result is not good. Maybe my code is wrong.
Then I change discriminator become autoencoder and try BEGAN 's loss, It is look good.

The VAE output after training is still blurry, but I found that the reconstructed image of the discriminator can make the VAE output clearer.
The main network structure is my simple custom resnet, which should be different to DCGAN.

Training Log

My training process output and logs can be found in the imgs and logs folders respectively.
The training log has been compressed and only needs to be decompressed.

How to use

Test

python3 test.py

I uploaded model weights in the repository. You can test with my weight right away.
Test output can be found in the test_output folder.
The upper three lines of each image are the VAE output, and the next three lines are the reconstructed output of the discriminator.

Train

python3 train.py

Just simple start train.py. The train will be start.
It will automatically reuse the previous weights if they are still there.
*.npz files is the networks weight. If you want a new training, just delete them simply.
If you see OOM, try to reduce batch_size or train with cpu.

Page Link

CVAE-GAN: Fine-Grained Image Generation through Asymmetric Training
https://arxiv.org/abs/1703.10155