Skip to content

Question about the code #35

@alamie

Description

@alamie

Thank you very much for the code! It's really great!

In the compute_generator_losses function, one can read:

if self.opt.lambda_PatchGAN > 0.0:
    real_feat = self.Dpatch.extract_features(
        self.get_random_crops(real),
        aggregate=self.opt.patch_use_aggregation).detach()
    mix_feat = self.Dpatch.extract_features(self.get_random_crops(mix))

    losses["G_mix"] = loss.gan_loss(
        self.Dpatch.discriminate_features(real_feat, mix_feat),
        should_be_classified_as_real=True,
    ) * self.opt.lambda_PatchGAN

and in the compute_patch_discriminator_losses function, one can read:

real_feat = self.Dpatch.extract_features(
            self.get_random_crops(real),
            aggregate=self.opt.patch_use_aggregation
        )
target_feat = self.Dpatch.extract_features(self.get_random_crops(real))
mix_feat = self.Dpatch.extract_features(self.get_random_crops(mix))
losses["PatchD_mix"] = loss.gan_loss(
    self.Dpatch.discriminate_features(real_feat, mix_feat),
    should_be_classified_as_real=False,
) * self.opt.lambda_PatchGAN

Why is should_be_classified_as_real set to True for G_mix and not for PatchD_mix?

When it comes to patches, shouldn't the gan_loss receive True when patches come from images with the same texture and False when they come from images with different textures?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions