HsinYingLee / DRIT

Learning diverse image-to-image translation from unpaired data
844 stars 155 forks source link

Question about content adversarial loss L^{content}_{adv} #17

Open lzhbrian opened 6 years ago

lzhbrian commented 6 years ago

Hi, thanks for this marvelous work! I am reading the paper and found equation (2) a little bit confusing. Why is the content adversarial loss function like this ?

codecogseqn 1

If we assign domain x to be 0, and domain y to be 1, then shouldn't this binary cross entropy loss look like? :

codecogseqn

Have I misunderstood anything? Thanks in advance!

HsinYingLee commented 6 years ago

If we assign x to be 0, y does not need to be 1. X part and Y part are actually separated. The meaning behind the loss is that: Given images from X, the discriminator should know it (D(E(x))=0) and the encoderx should make it indiscriminative (D(E(x))=1/2). So do images from Y. So the loss function can be written like: [<a href="https://www.codecogs.com/eqnedit.php?latex=L^{content}{adv}&space;=&space;L^{contentx}{adv}+&space;L^{contenty}{adv}" target="blank"><img src="https://latex.codecogs.com/gif.latex?L^{content}{adv}&space;=&space;L^{contentx}{adv}+&space;L^{contenty}{adv}" title="L^{content}_{adv} = L^{contentx}{adv}+ L^{contenty}{adv}" />](url)

lzhbrian commented 6 years ago

Thanks for the quick reply.

I'm still a little confused.

I understand that E's job is to make the features indiscriminative (D(E(x))=1/2)

However, if I understand it right, D^c 's job is to distinguish encoded content features between domain X and domain Y. Given that we are using one discriminator D^c for both domain X and Y, what D^c would like to do is to make domain X closer to 0, and domain Y closer to 1. (i.e. to make them apart from each other as far as possible) If these two parts are considered separately, what would D^c's job actually be?

chl916185 commented 6 years ago

self.dataset_size = max(self.A_size, self.B_size) ? max or min @HsinYingLee

zhangqianhui commented 6 years ago

@lzhbrian @HsinYingLee I also think this loss has some problems.

controny commented 5 years ago

@lzhbrian The loss for D^c and that for E are not the same. Equation (2) in the paper is the loss for E, according to function backward_G_GAN_content. The loss for D^c should be E_x[log(1-D^c(E^c_x(x))] + E_y[logD^c(E^c_y(y))], where label for x is 0 and label for y is 1, according to function backward_contentD.