mingyuliutw / UNIT

Unsupervised Image-to-Image Translation
Other
1.98k stars 360 forks source link

3 Questions #54

Closed taki0112 closed 6 years ago

taki0112 commented 6 years ago

Hi ! Q1 When using Image translation, did you not use augmentation? I want to know about this, but I can not find it in your code

Q2 For example, suppose I want to convert from domain_A (dog) to domain_B (cat). (domainA -> domain_B)

Assume that the number of dog images in domain_A is 1000, and the number of cat images in domain_B is 1500. (That means # domainA < # domainB)

If so, how do I train? I think the learning imbalance will happen because the number of data in two domains is different. Did you make the number of images in both domains the same?

Q3 Generator_loss = G_A_loss + G_B_loss Discriminator_loss = D_A_loss + D_B_loss

When you train Generator A and B, why did you train with sum of two loss(Generator_loss), instead of training about G_A_loss and G_B_loss, respectively? Likewise, why did the Discriminator do so?

mingyuliutw commented 6 years ago

For Q1, YES. I do random cropping and mirroring. For details, please check dataset_image.py

For Q2, NO. We do not do any dataset size control. It is hard to say what will happen. It depends on the complexity of the domains.

For Q3, based on my understanding of how PyTorch is implemented. The two versions you described will have the same results.

taki0112 commented 6 years ago

I have one question... If Input_size is 256x256x3 not scale,, then output_size is 276x276x3 in my tensorflow code...

If you run your code, does it have this size? (276x276x3)

mingyuliutw commented 6 years ago

No. The output image size is same as the input image size.

taki0112 commented 6 years ago

Thank you for answering my many questions. I completed reproduce with tensorflow. Look, if there is a strange part, please tell me.

My code training results will be posted as soon as training ends. https://github.com/taki0112/UNIT-Tensorflow

taki0112 commented 6 years ago

Why did not use KL_divergence before modified ?

  def _compute_kl(self, mu, sd):
    mu_2 = torch.pow(mu, 2)
    sd_2 = torch.pow(sd, 2)
    encoding_loss = (mu_2 + sd_2 - torch.log(sd_2)).sum() / mu_2.size(0)
    return encoding_loss

could you tell me ?

mingyuliutw commented 6 years ago

@taki0112 Sorry, I don't understand your question.

taki0112 commented 6 years ago

In your code, There is two _compue_kl (KL divergence)

  1. def _compute_kl(self, mu, sd):
    mu_2 = torch.pow(mu, 2)
    sd_2 = torch.pow(sd, 2)
    encoding_loss = (mu_2 + sd_2 - torch.log(sd_2)).sum() / mu_2.size(0)
    return encoding_loss
  2. def _compute_kl(self, mu):
    mu_2 = torch.pow(mu, 2)
    encoding_loss = torch.mean(mu_2)
    return encoding_loss

Why did not use first _comput_kl ?

mingyuliutw commented 6 years ago

The first one requires a larger memory footprint but is more flexible. I was trying to save some memory space.

taki0112 commented 6 years ago

I See. Thank you. I would appreciate if you check my tensorflow version UNIT

Thank you for answering my many many many questions !!!!!!!!!!!

mhusseinsh commented 6 years ago

@mingyuliutw @taki0112 for the UNIT implementation, do the datasizes have to be the same ? I have domainA=20k images, and domainB=19.5K images

will the network give me an error while training ? or is it ok, they stick to the max/min number of dataset ?

Another question: so you had the configs set on 1M iterations, so with a batch size of 1, this means that for each iteration, an image is fed. So after the 20K images are fed, it repeats itself again ?