RenYurui / Global-Flow-Local-Attention

The source code for paper "Deep Image Spatial Transformation for Person Image Generation"
https://renyurui.github.io/GFLA-web
Other
561 stars 84 forks source link

Style Loss in your code #62

Open PangzeCheung opened 3 years ago

PangzeCheung commented 3 years ago

I found that the layers of vgg you used in the style loss and content loss are different. x_vgg, y_vgg = self.vgg(x), self.vgg(y)

content_loss = 0.0 content_loss += self.weights[0] self.criterion(x_vgg['relu1_1'], y_vgg['relu1_1']) content_loss += self.weights[1] self.criterion(x_vgg['relu2_1'], y_vgg['relu2_1']) content_loss += self.weights[2] self.criterion(x_vgg['relu3_1'], y_vgg['relu3_1']) content_loss += self.weights[3] self.criterion(x_vgg['relu4_1'], y_vgg['relu4_1']) content_loss += self.weights[4] * self.criterion(x_vgg['relu5_1'], y_vgg['relu5_1'])

style_loss = 0.0 style_loss += self.criterion(self.compute_gram(x_vgg['relu2_2']), self.compute_gram(y_vgg['relu2_2'])) style_loss += self.criterion(self.compute_gram(x_vgg['relu3_4']), self.compute_gram(y_vgg['relu3_4'])) style_loss += self.criterion(self.compute_gram(x_vgg['relu4_4']), self.compute_gram(y_vgg['relu4_4'])) style_loss += self.criterion(self.compute_gram(x_vgg['relu5_2']), self.compute_gram(y_vgg['relu5_2']))

And I can't find this part in https://github.com/dxyang/StyleTransfer/blob/master/utils.py Why choose a different layer? Thank you very much.

RenYurui commented 3 years ago

Hi PangzeCheung, There is no specific reason for the choice. I think both of them are OK.