GithubHelp home page GithubHelp logo

gans-public's People

Contributors

ezelikman avatar lucasrct avatar ryan-keenan avatar sharobsinha 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

gans-public's Issues

Swaped labels for discriminator loss in SRGAN?

Hello,

thank you for providing these nice GAN implementations!

I was wondering whether the labels for the discriminator loss in SRGAN are swapped? At the moment it looks like the following:

from torchvision.models import vgg19

class Loss(nn.Module):

     ...

    def adv_loss(self, x, is_real):
        target = torch.zeros_like(x) if is_real else torch.ones_like(x)
        return F.binary_cross_entropy_with_logits(x, target)

    def forward(self, generator, discriminator, hr_real, lr_real):
        ''' Performs forward pass and returns total losses for G and D '''
        hr_fake = generator(lr_real)
        fake_preds_for_g = discriminator(hr_fake)
        fake_preds_for_d = discriminator(hr_fake.detach())
        real_preds_for_d = discriminator(hr_real.detach())

        g_loss = (
            0.001 * self.adv_loss(fake_preds_for_g, False) + \
            0.006 * self.vgg_loss(hr_real, hr_fake) + \
            self.img_loss(hr_real, hr_fake)
        )
        d_loss = 0.5 * (
            self.adv_loss(real_preds_for_d, True) + \
            self.adv_loss(fake_preds_for_d, False)
        )

        return g_loss, d_loss, hr_fake

Shouldn't it be the other way round for the discriminator loss as you want ones for the real_preds and zeros for the fake_preds?

        d_loss = 0.5 * (
            self.adv_loss(real_preds_for_d, False) + \
            self.adv_loss(fake_preds_for_d, True)
        )

Or maybe change the adv_loss function so that is_real corresponds to ones:

    def adv_loss(self, x, is_real):
        target = torch.ones_like(x) if is_real else torch.zeros_like(x)
        return F.binary_cross_entropy_with_logits(x, target)

and then g_loss to:

        g_loss = (
            0.001 * self.adv_loss(fake_preds_for_g, True) + \
            0.006 * self.vgg_loss(hr_real, hr_fake) + \
            self.img_loss(hr_real, hr_fake)
        )

But maybe I also get it wrong.

Best,
Christoph

FreezeD Model Not Downloading Correctly

In the 'Checkpoint' part of the notebook, a model named 'stylegan-256px.pt' is supposed to be downloaded from a google drive link. If you examine the contents of the downloaded file, the contents are HTML code. Within this HTML code, you can find a link to download the actual model, but if you don't download the actual model, issues will arise later in the code. For me, I had an issue stating "invalid load key, '<'." when running the code under the "Fine-tuning StyleGAN on Anime Faces" header before I realized the model was an HTML file instead of a model.

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.