Collection of generative models, e.g. GAN, VAE in Pytorch and Tensorflow.

Overview

Generative Models

Collection of generative models, e.g. GAN, VAE in Pytorch and Tensorflow. Also present here are RBM and Helmholtz Machine.

Note:

Generated samples will be stored in GAN/{gan_model}/out (or VAE/{vae_model}/out, etc) directory during training.

What's in it?

Generative Adversarial Nets (GAN)

  1. Vanilla GAN
  2. Conditional GAN
  3. InfoGAN
  4. Wasserstein GAN
  5. Mode Regularized GAN
  6. Coupled GAN
  7. Auxiliary Classifier GAN
  8. Least Squares GAN
  9. Boundary Seeking GAN
  10. Energy Based GAN
  11. f-GAN
  12. Generative Adversarial Parallelization
  13. DiscoGAN
  14. Adversarial Feature Learning & Adversarially Learned Inference
  15. Boundary Equilibrium GAN
  16. Improved Training for Wasserstein GAN
  17. DualGAN
  18. MAGAN: Margin Adaptation for GAN
  19. Softmax GAN
  20. GibbsNet

Variational Autoencoder (VAE)

  1. Vanilla VAE
  2. Conditional VAE
  3. Denoising VAE
  4. Adversarial Autoencoder
  5. Adversarial Variational Bayes

Restricted Boltzmann Machine (RBM)

  1. Binary RBM with Contrastive Divergence
  2. Binary RBM with Persistent Contrastive Divergence

Helmholtz Machine

  1. Binary Helmholtz Machine with Wake-Sleep Algorithm

Dependencies

  1. Install miniconda http://conda.pydata.org/miniconda.html
  2. Do conda env create
  3. Enter the env source activate generative-models
  4. Install Tensorflow
  5. Install Pytorch
Comments
  • How to compute inception score with the  images produced by Wgan?

    How to compute inception score with the images produced by Wgan?

    Hi,

    Do you know how to reshape image output by your code in order to get inception score (I guess this code is for coloured images).

    here is the inception github code: https://github.com/openai/improved-gan/tree/master/inception_score

    Thanks in advance

    opened by tldoan 7
  • bug in your VAE cost

    bug in your VAE cost

    loss = recon_loss + kl_loss

    While you should have loss = recon_loss - kl_loss

    To perform gradient descent.

    If not you should loss = -recon_loss + kl_loss and perform gradient ascent.

    The ELbo to maximize is: ELBO = -DKL + LogLikelihood

    Your kl_loss correspond to the -DKL and your binary error to -LogLikelihood. So you have to change your -DKL to be DKL to minimize the ELBO, if not change sign from LogLikelihood and maximize.

    opened by jmaronas 5
  • Discrete Boundary-Seeking GANs

    Discrete Boundary-Seeking GANs

    Hi,

    I think the current implementation for Boundary-seeking GANs is only applicable for continuous variables, and not for discrete which was the main contribution of the paper. Is a discrete implementation in the works?

    opened by ankeshanand 5
  • WGAN Wasserstein algorithm

    WGAN Wasserstein algorithm

    In the code , did you use Wasserstein to count the distance between discriminator and generator ? I can't see the algorithm of it, could you shed a light ? Thanks

    opened by tcglarry 5
  • InfoGAN: Q_loss question

    InfoGAN: Q_loss question

    Hi, great work and repo. I have one question about the way the Qloss is computed in infoGAN here ent = tf.reduce_mean(-tf.reduce_sum(tf.log(c + 1e-8) * c, 1)) To me, log(c) is not correct there. I guess it should be log(P(c)), so log(0.1) in this implementation. With that, the Qloss value than reach the 2.3 of H(c) mentioned in the paper. Does it make sense? Thanks

    opened by andreazanetti 4
  • Coupled GAN display noise only

    Coupled GAN display noise only

    I have used coupled GAN code for my own customize dataset. Discriminator and generator loss not decrease or increase and output noise only. I am unable to understand what is the real problem. Can you please help me ? I have tried to debug it but it generate noise images. please help me! Same generator and discriminator loss. untitled

    opened by ghost 4
  • How to extract encoded features from an adversarial autoencoder (AAE)

    How to extract encoded features from an adversarial autoencoder (AAE)

    Hello Wiseodd,

    The source code of GAN and its variations provided here are very helpful for those who are interested in applying GAN in bioinformatics.

    My question is how to extract encoded features from an AAE (e.g. aae_pytorch.py in the VAE folder). After reading the codes in aae_pytorch.py, I guess that the following codes can be used to extracted the encoded features of training set of MNIST data.

    X = Variable(torch.from_numpy(mnist.train.images))
    z_fake = Q(X)
    np.savetxt('encoded_feature_MNIST.txt', z_fake.data.numpy())
    

    Am I correct?

    Thanks,

    Xiangchun

    opened by lixiangchun 4
  • fix a mix use of tensor( size 64x1 ) and tensor( size 64 )

    fix a mix use of tensor( size 64x1 ) and tensor( size 64 )

    fix a mix use of tensor( size 64x1 ) and tensor( size 64 ) which results: UserWarning: Using a target size (torch.Size([64])) that is different to the input size (torch.Size([64, 1])) is deprecated. Please ensure they have the same size.

    opened by mayorx 3
  • Addition to the GAN collection

    Addition to the GAN collection

    Hi, If its possible, could you please add our variant of GAN to your collection too? It's a semi-supervised version of infoGAN. Thanks!

    https://arxiv.org/abs/1707.04487

    opened by spurra 3
  • AttributeError: 'NoneType' object has no attribute 'data'

    AttributeError: 'NoneType' object has no attribute 'data'

    Hi, I have got an error while running python infogan_pytorch.py

    Extracting ../../MNIST_data/train-images-idx3-ubyte.gz Extracting ../../MNIST_data/train-labels-idx1-ubyte.gz Extracting ../../MNIST_data/t10k-images-idx3-ubyte.gz Extracting ../../MNIST_data/t10k-labels-idx1-ubyte.gz /home/arghyapal/miniconda2/envs/generative-models/lib/python3.5/site-packages/torch/optim/adam.py:74: UserWarning: tensor1 is not broadcastable to self, but they have the same number of elements. Falling back to deprecated pointwise behavior. p.data.addcdiv_(-step_size, exp_avg, denom) Traceback (most recent call last): File "infogan_pytorch.py", line 119, in <module> reset_grad() File "infogan_pytorch.py", line 86, in reset_grad p.grad.data.zero_() AttributeError: 'NoneType' object has no attribute 'data'

    Please help me...!!!

    opened by ArghyaPal 3
  • generation of vanilla_gan at the end are all 1-s

    generation of vanilla_gan at the end are all 1-s

    Hi, @wiseodd ,

    Thanks for your cool implementation of these models!

    I'm a newbie to GANs and tensorflow. I've tried vanilla gan by running gan_tensorflow.py.

    At the end of training, the content of G becomes all 1-s, ie, all the squares just contain the image of number one, not like the snapshot in the mid-term of the training, all numbers are generated.

    Are these results correct? How to explain it? Thanks in advance!

    Best regards.

    opened by stoneyang 3
  • Is there a wrong computation of KL in the blog post example between KL[Q(z|X) || P(z)]?

    Is there a wrong computation of KL in the blog post example between KL[Q(z|X) || P(z)]?

    In your blog post you have image

    Shouldn't that be image

    I think in your formulation tr(Σ(Χ)) should be tr(Σ^(-1)(Χ)) μ(Χ)^(Τ) μ(Χ) should be μ(Χ)^(Τ) Σ^(-1)(Χ) μ(Χ) -log(det(Σ(Χ))) should be +log(det(Σ(Χ)))

    opened by kirk86 0
  • Issue with conditional-gan for tensorflow version

    Issue with conditional-gan for tensorflow version

    Hey guys, I'm using the conditional-gan code for tensorflow version to generate garment drawings, the training images is RGB png file, labels are vectors like this [1,2,3,4,...,2],I just changed the feeding training data from mnist to my data, but the generated images are shapeless, I don't know why, someone helps me? thanks!! The attached is the modified code and images generated.

    code+generated images.zip

    opened by janker5 1
  • Vanilla Variational Auto Encoder

    Vanilla Variational Auto Encoder

    Hello WiseOdd,

    I have recognise you vanilla VAE, which seems pretty neat despite of the fact that does not work as I remember a Gassian noise sparse model would work.

    I have recently read 1606.05908 where VAE are explained quite good more or less. Threre is the PDF for X described as expectation value over $P(Z)$. Now, when you update your parameters of the Gaussian, normally the variance is a diagonal matrix of $\sigma^2$. So, of cause one could think about a variance for each point in the dimensionality of X, but I am not qute sure that is the proper common idea behind the variance of the Gaussian distribution in generative models.

    $P(X) = \frac{1}{D_z} \sum_{\forall z \in Z} P(X|Z, \Theta) P(Z)$ using this annotation, the expectation for $\sigma^2$ based on the data would be something similar to $\sum_{\forall n \in N} \braket{X-\mu(z;\Theta)|X-\mu(z;\Theta)}$, right?

    Maybe you can take a look on that code. Because your variance seems to appear as a matrix instead of a value or set of values for the Gaussian noise model.

    So, did you thought explicitly about a full covariance matrix or was it just trial and error in this case?

    If trying out expectation value(s) for the variance, let me know, what your experience is.

    regards, Markus

    opened by markusMM 0
Owner
Agustinus Kristiadi
Agustinus Kristiadi
PyTorch Autoencoders - Implementing a Variational Autoencoder (VAE) Series in Pytorch.

PyTorch Autoencoders Implementing a Variational Autoencoder (VAE) Series in Pytorch. Inspired by this repository Model List check model paper conferen

Subin An 8 Nov 21, 2022
A method that utilized Generative Adversarial Network (GAN) to interpret the black-box deep image classifier models by PyTorch.

A method that utilized Generative Adversarial Network (GAN) to interpret the black-box deep image classifier models by PyTorch.

Yunxia Zhao 3 Dec 29, 2022
Annotated, understandable, and visually interpretable PyTorch implementations of: VAE, BIRVAE, NSGAN, MMGAN, WGAN, WGANGP, LSGAN, DRAGAN, BEGAN, RaGAN, InfoGAN, fGAN, FisherGAN

Overview PyTorch 0.4.1 | Python 3.6.5 Annotated implementations with comparative introductions for minimax, non-saturating, wasserstein, wasserstein g

Shayne O'Brien 471 Dec 16, 2022
PyTorch package for the discrete VAE used for DALL·E.

Overview [Blog] [Paper] [Model Card] [Usage] This is the official PyTorch package for the discrete VAE used for DALL·E. Installation Before running th

OpenAI 9.5k Jan 5, 2023
Official Pytorch implementation of the paper "Action-Conditioned 3D Human Motion Synthesis with Transformer VAE", ICCV 2021

ACTOR Official Pytorch implementation of the paper "Action-Conditioned 3D Human Motion Synthesis with Transformer VAE", ICCV 2021. Please visit our we

Mathis Petrovich 248 Dec 23, 2022
Collection of generative models in Pytorch version.

pytorch-generative-model-collections Original : [Tensorflow version] Pytorch implementation of various GANs. This repository was re-implemented with r

Hyeonwoo Kang 2.4k Dec 31, 2022
VideoGPT: Video Generation using VQ-VAE and Transformers

VideoGPT: Video Generation using VQ-VAE and Transformers [Paper][Website][Colab][Gradio Demo] We present VideoGPT: a conceptually simple architecture

Wilson Yan 470 Dec 30, 2022
CVPR 2021: "Generating Diverse Structure for Image Inpainting With Hierarchical VQ-VAE"

Diverse Structure Inpainting ArXiv | Papar | Supplementary Material | BibTex This repository is for the CVPR 2021 paper, "Generating Diverse Structure

null 152 Nov 4, 2022
Official code for "End-to-End Optimization of Scene Layout" -- including VAE, Diff Render, SPADE for colorization (CVPR 2020 Oral)

End-to-End Optimization of Scene Layout Code release for: End-to-End Optimization of Scene Layout CVPR 2020 (Oral) Project site, Bibtex For help conta

Andrew Luo 41 Dec 9, 2022
The official implementation of VAENAR-TTS, a VAE based non-autoregressive TTS model.

VAENAR-TTS This repo contains code accompanying the paper "VAENAR-TTS: Variational Auto-Encoder based Non-AutoRegressive Text-to-Speech Synthesis". Sa

THUHCSI 138 Oct 28, 2022
FuseDream: Training-Free Text-to-Image Generationwith Improved CLIP+GAN Space OptimizationFuseDream: Training-Free Text-to-Image Generationwith Improved CLIP+GAN Space Optimization

FuseDream This repo contains code for our paper (paper link): FuseDream: Training-Free Text-to-Image Generation with Improved CLIP+GAN Space Optimizat

XCL 191 Dec 31, 2022
DR-GAN: Automatic Radial Distortion Rectification Using Conditional GAN in Real-Time

DR-GAN: Automatic Radial Distortion Rectification Using Conditional GAN in Real-Time Introduction This is official implementation for DR-GAN (IEEE TCS

Kang Liao 18 Dec 23, 2022
HiFi-GAN: Generative Adversarial Networks for Efficient and High Fidelity Speech Synthesis

HiFi-GAN: Generative Adversarial Networks for Efficient and High Fidelity Speech Synthesis Jungil Kong, Jaehyeon Kim, Jaekyoung Bae In our paper, we p

Rishikesh (ऋषिकेश) 31 Dec 8, 2022
Minimal PyTorch implementation of Generative Latent Optimization from the paper "Optimizing the Latent Space of Generative Networks"

Minimal PyTorch implementation of Generative Latent Optimization This is a reimplementation of the paper Piotr Bojanowski, Armand Joulin, David Lopez-

Thomas Neumann 117 Nov 27, 2022
Simple Tensorflow implementation of Toward Spatially Unbiased Generative Models (ICCV 2021)

Spatial unbiased GANs — Simple TensorFlow Implementation [Paper] : Toward Spatially Unbiased Generative Models (ICCV 2021) Abstract Recent image gener

Junho Kim 16 Apr 15, 2022
House-GAN++: Generative Adversarial Layout Refinement Network towards Intelligent Computational Agent for Professional Architects

House-GAN++ Code and instructions for our paper: House-GAN++: Generative Adversarial Layout Refinement Network towards Intelligent Computational Agent

null 122 Dec 28, 2022
NR-GAN: Noise Robust Generative Adversarial Networks

NR-GAN: Noise Robust Generative Adversarial Networks (CVPR 2020) This repository provides PyTorch implementation for noise robust GAN (NR-GAN). NR-GAN

Takuhiro Kaneko 59 Dec 11, 2022
π-GAN: Periodic Implicit Generative Adversarial Networks for 3D-Aware Image Synthesis

π-GAN: Periodic Implicit Generative Adversarial Networks for 3D-Aware Image Synthesis Project Page | Paper | Data Eric Ryan Chan*, Marco Monteiro*, Pe

null 375 Dec 31, 2022