pix2pixHD
pix2pixHD copied to clipboard
Feature Match loss Issue
hi tcwang:
-
if not self.opt.no_ganFeat_loss:
-
feat_weights = 4.0 / (self.opt.n_layers_D + 1)
-
D_weights = 1.0 / self.opt.num_D
-
for i in range(self.opt.num_D):
-
for j in range(len(pred_fake[i])-1):
-
loss_G_GAN_Feat += D_weights * feat_weights * \
-
the paper mentioned that Dk only serves as a feature extractor and does not maximize the feature matching loss. but when I read the code, I see the last line only pred_real[i][j] using detach. Is it correct? Does "not maximize the loss" here mean the D not participate in autograd. so. you should set requires_grad of parameter of D as falseself.criterionFeat(pred_fake[i][j], pred_real[i][j].detach()) * self.opt.lambda_feat
Have you solved the problem? I have the same question
You need to detach the target image logits, you only backpropagate the fake's. The code is correct.