Coder Social home page Coder Social logo

Comments (7)

mrgloom avatar mrgloom commented on August 27, 2024 1

I found this comment in pix2pix paper In addition, we divide the objective by 2 while optimizing D, which slows down the rate at which D learns relative to G. and in cyclegan paper In practice, we divide the objective by 2 while optimizing D, which slows down the rate at which D learns, relative to the rate of G.

Actually I have tested it without 0.5 on simple dataset like parabola from here and it still works.

from keras-gan.

aniketmaurya avatar aniketmaurya commented on August 27, 2024

Loss from real and fake images are averaged. CMIIW, I guess this is how loss is calculated in the paper but if we just sum the loss then also we might get the same result.

from keras-gan.

mrgloom avatar mrgloom commented on August 27, 2024

Discriminator use BCE loss:
BCE = - y * log(y_pred) - (1 - y) * log(1 - y_pred)
as I understand we can rewrite this code https://github.com/eriklindernoren/Keras-GAN/blob/master/gan/gan.py#L121-L122 as d_loss = self.discriminator.train_on_batch([gen_imgs, imgs], [fake, valid]), by [gen_imgs, imgs] here I mean concatenate.

I guess this is how loss is calculated in the paper

Can you point out where it's specified in the paper?

from keras-gan.

mrgloom avatar mrgloom commented on August 27, 2024

Actually I was not able to break it even with d_loss = 100000.0 * np.add(d_loss_real, d_loss_fake), as I understand in this keras code it's not affect the training procedure, but just just averages metrics for display.

from keras-gan.

aniketmaurya avatar aniketmaurya commented on August 27, 2024

Multiplying loss with a constant will have same effect as that of a learning rate. While training a GAN we two try that both generator and discriminator learns at the same pace.

from keras-gan.

mrgloom avatar mrgloom commented on August 27, 2024

I mean as I understand in Keras if you want to apply weight to loss you should use loss_weights in compile https://github.com/eriklindernoren/Keras-GAN/blob/master/gan/gan.py#L29-L31

            loss_weights: Optional list or dictionary specifying scalar
                coefficients (Python floats) to weight the loss contributions
                of different model outputs.
                The loss value that will be minimized by the model
                will then be the *weighted sum* of all individual losses,
                weighted by the `loss_weights` coefficients.
                If a list, it is expected to have a 1:1 mapping
                to the model's outputs. If a tensor, it is expected to map
                output names (strings) to scalar coefficients.

but if you already get metrics, you just multiply them by constant here https://github.com/eriklindernoren/Keras-GAN/blob/master/gan/gan.py#L123 and it's not affecting the training process, I mean this multiplication is not 'part of the graph' like for example in tensorflow.

from keras-gan.

Nevermetyou65 avatar Nevermetyou65 commented on August 27, 2024

I come here for the same question.

from keras-gan.

Related Issues (20)

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.