Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

content loss calculation is wrong? #24

Closed
RyanCV opened this issue Feb 21, 2018 · 1 comment
Closed

content loss calculation is wrong? #24

RyanCV opened this issue Feb 21, 2018 · 1 comment

Comments

@RyanCV
Copy link

RyanCV commented Feb 21, 2018

Hi, I found the vgg16 loss network returns [relu1_2, relu2_2, relu3_3, relu4_3], and in your neural_style.py,

y = transformer(x)
features_y = vgg(y)
f_xc_c = Variable(features_xc[1].data, requires_grad=False)
content_loss = args.content_weight * mse_loss(features_y[1], f_xc_c)

the features_y is a list of loss corresponding to [relu1_2, relu2_2, relu3_3, relu4_3], the index for relu1_2, relu2_2, relu3_3 and relu4_3 is 0, 1, 2, and 3, right? In the paper, it used relu3_3 as content loss, so, here should it be the following?
f_xc_c = Variable(features_xc[2].data, requires_grad=False) content_loss = args.content_weight * mse_loss(features_y[2], f_xc_c)
Thanks.

@abhiskk
Copy link
Owner

abhiskk commented Feb 21, 2018

From the paper Johnson et al., Training details on page 9:

For all style transfer experiments we compute
feature reconstruction loss at layer relu2_2

@abhiskk abhiskk closed this as completed Mar 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants