Giter VIP home page Giter VIP logo

tensorflow-generative-model-collections's People

Contributors

flrngel avatar hwalsuklee avatar nazywamsiepawel avatar niffler92 avatar togheppi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tensorflow-generative-model-collections's Issues

Don't use batch_normalization

See here, updates_collections=None which means moving_mean and moving_var won't be put into tf.GraphKeys.UPDATE_OPS. so tf.get_collection(tf.GraphKeys.UPDATE_OPS) is [], I think it's a bug.

But if you just delete updates_collections=None, it can't work. Because there are two graphs for discriminators and there are different moving_mean and moving_var for different graph. So I think you should use different tf.control_dependencies for discriminator and generator.

Continuous latent loss possibly wrong in InfoGAN

In InfoGAN.py line 146, the squared loss is being optimized as follows.

cont_code_est = code_fake[:, self.len_discrete_code:]
cont_code_tg = self.y[:, self.len_discrete_code:]
q_cont_loss = tf.reduce_mean(tf.reduce_sum(tf.square(cont_code_tg - cont_code_est), axis=1))

The code_fake vector is in [0,1] as it comes from a softmax non-linearity. The actual latent code being sent, however, is in [-1,1]. (See line 234).

batch_codes = np.concatenate((batch_labels, np.random.uniform(-1, 1, size=(self.batch_size, 2))),
                                             axis=1)

Am I missing something?

Maybe it's unnecessary to use weight clipping in the LSGAN?

Thank you for sharing your codes.

I found that there is no weight clipping in the paper Least Squares Generative Adversarial Networks. The weight clipping is used in the paper Loss-Sensitive Generative Adversarial Networks on Lipschitz Densities. Obviously, your code is the former.

I tried both situations, and the performance is better without weight clipping.

I changed the network structure and adjusted the super-parameters to apply to data cifar-10. I thought maybe someone needed it, so I left the url of my code.
https://github.com/AliceAria/Performance-comparison-of-GAN-on-cifar-10

Thanks again.

WGAN_GP - tensorflow

Hey, I appreciate your work! You make my life better.

I found (maybe) a small bug in your WGAN_GP code. When calculating gradient penalty, you write:

D_inter,_,_=self.discriminator(interpolates, is_training=True, reuse=True) 
gradients = tf.gradients(D_inter, [interpolates])[0]

You use the sigmoid output of the Discriminator, not the logits.

In the original implementation (https://github.com/igul222/improved_wgan_training/blob/master/gan_mnist.py), they write this:

gradients = tf.gradients(Discriminator(interpolates), [interpolates])[0]

Here, the authors only return the logits of the Discriminator. So they use the logits for this calculation.

Did you do this on purpose?

Greetings!

Gradient Penalty code error in WGAN_GP

at 113 line in WGAN_GP, I recommend changing the code

alpha = tf.random_uniform(shape=self.inputs.get_shape(), minval=0.,maxval=1.)
to
alpha = tf.random_uniform(shape=[BATCH_SIZE,1,1,1], minval=0.,maxval=1.)

Because It must be created one alpha value for each batch

request about input data

Thank you very much for sharing your perfect code with everyone. I learned a lot from it. I found that in all GAN networks, your input data is binary image data like mnist. I wonder if you have any modifications to the input training data. You can enter color images or grayscale images into the network for training. If you make a change, can you share me an improved code and let me learn your method.
  Regardless of whether you have made any changes, I thank you very much for sharing.

Question about LSGAN

Thanks for your great work! I find that the discriminatior in LSGAN calculated by sigmoid(logits). But according to the original paper D(x) should be logits directly. If the sigmoid function is used in D(x), the problem of gradient vanishing still exists. I'm not sure whether i misinterpreted the idea of the paper.

Question about marginal_likelihood in VAE

Thank you for your working and sharing. I learned a lot from them.
However, I have a question about the VAE implementation.
In VAE.py, you calculate the marginal_likelihood as an cross entropy:
marginal_likelihood = tf.reduce_sum(self.inputs * tf.log(self.out) + (1 - self.inputs) * tf.log(1 - self.out),[1, 2])
However, I am confusing as the formular is :
image
where the first item on the right side should correspond to the marginal_likelihood. I think the latent variable z should be included to calculate the likelihood but you use the initial input, self.inputs.
So I am a little confusing, can you explain it?
Thank you very much!

link Fashion-MNIST readme to this notebook

Hi, I'm the author of Fashion-MNIST dataset. I found the GANs results on Fashion-MNIST is very interesting, especially how ACGAN and infoGAN failed on Fashion-MNIST. I already highlighted this notebook in Fashion-MNIST README.md. I hope it is ok for you. 🙇

Here are the links:
https://github.com/zalandoresearch/fashion-mnist#other-explorations-of-fashion-mnist
https://github.com/zalandoresearch/fashion-mnist/blob/master/README.zh-CN.md#生成对抗网络-gans

Question about batch normalization in WGAN_GP

Thank for your work! I'm confused about the batch normalization layer used in the discriminator of wgan_gp. I think there shouldn't be any batch normalization layer in the discriminator.
I think the reason is that the gradient penalty term directly otimizes the gradient loss of each vector sampled between data distribution and generated distribution, each of the vectors has its gradient and the gradient is independent of all other vectors, so the gradient penalty must be calculated separately w.r.t. each sampled vector. If batch normalization is applied in discriminator, the region constrained by 1-Lipchitz, I guess, would be somewhere else instead of "the region between data distribution and generated distribution".
I'm not sure whether i misinterpreted the idea of wgan-gp paper.

Very fast convergence in VAE and CVAE

Hi,I have run your VAE and CVAE models, but I found that it converged very fast, didn't need more than 2 or 3 epoch, but the results in them are very good. It confused me ,would you please give me some explanation when you are free?

Not an issue

Hey @hwalsuklee,

Thanks for sharing your code which helps me a lot. I have a question about the linear function in ops.py

I would be appreciated if you can explain what you are doing in the this function.

def linear(input_, output_size, scope=None, stddev=0.02, bias_start=0.0, with_w=False):
    shape = input_.get_shape().as_list()

    with tf.variable_scope(scope or "Linear"):
        matrix = tf.get_variable("Matrix", [shape[1], output_size], tf.float32,
                 tf.random_normal_initializer(stddev=stddev))
        bias = tf.get_variable("bias", [output_size],
        initializer=tf.constant_initializer(bias_start))
        if with_w:
            return tf.matmul(input_, matrix) + bias, matrix, bias
        else:
            return tf.matmul(input_, matrix) + bias

Also, It would be great if you add some comments when you are implementing; to be much easier for others to understand.

Thanks.

Not an issue, but a request

Hi @hwalsuklee ,
Thank you for sharing this neat-n-clean code... It's really helpful.

I have two requests:
1. Could you please provide a model to generate RGB data like: CIFAR 10 or SVHN. From your past comments, I realized that you are working on CelebA dataset. Would you be so kind to share your code on those (above-mentioned dataset) too?
2. It seems Co-GAN is missing. Would you be so kind to provide a code for Co-GAN too...!!

Thank you again for sharing your code,
With Best Regards,
Arghya.

about loss D_real or D_real_logits use ?

thanks you code , when i read the code , the discriminator use sigmoid output, but you also return D_real_logits ,and when caluate the loss real or fake ,you use D_real_logits or D_fake_logits before sigmoid output ; why you don't use the D_real or D_fake ,the sigmoid ouput?
# get loss for discriminator d_loss_real = - tf.reduce_mean(D_real_logits) d_loss_fake = tf.reduce_mean(D_fake_logits)

thank ,can you help me?

Bug in model constructors

You have this line in all the constructors:

if dataset_name == 'mnist' or 'fashion-mnist':

It will always be True. You want if dataset_name == 'mnist' or dataset_name == 'fashion-mnist' or if dataset_name in ['mnist', 'fashion-mnist'].

CGAN convergence time

I've noticed an inefficiency in the CGAN code. When we append the one-hot encoded labels to the image, they influence the training gradients a lot. Instead, I've noticed that scaling the one-hot encoded labels down by a factor of 0.01 or even 0.001 helps the CGAN converge around twice as fast.

That would mean changing opts.py's conv_cond_concat function. My hack was to change return concat([x, y*tf.ones([x_shapes[0], x_shapes[1], x_shapes[2], y_shapes[3]])], 3) to return concat([x, 0.001*y*tf.ones([x_shapes[0], x_shapes[1], x_shapes[2], y_shapes[3]])], 3) and that worked well for me. I'm not too sure about in general though, perhaps try adding batch norm?

about CVAE's input

Thanks for the nicely orgnized code, I learned a lot from it. But I have question about the CVAE's input, you just append y's 1-hot code to the last dimension of x, so it makes the original data up to 11 times larger (the image shape becomes 28 * 28 * 11). But why not just append y in the middle of the encoding process, say, when we get a flat vector after several conv2d transformation, then we could append y to this flat vector?

FID score

Hello @hwalsuklee, thanks for the repo!

Would i be a good idea to also add the FID score and/or inception score to the various experiments?

Thanks!

Questions about training ACGAN

Thanks for your contribution!
A problem occurs when I am training ACGAN without tuning any parameters which is shown as follows:
As the training process goes on, the loss of D is declining, but the loss of G is increasing on the contrary...and the gap between two of them is pretty large. I do not know how to solve it...
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.