swapping-autoencoder-pytorch icon indicating copy to clipboard operation
swapping-autoencoder-pytorch copied to clipboard

Question about the code

Open alamie opened this issue 3 years ago • 1 comments

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?

alamie avatar Nov 02 '22 10:11 alamie

@taesungp @richzhang Is this a misunderstanding on my side?

alamie avatar Nov 09 '22 08:11 alamie