Last active
May 6, 2018 05:45
-
-
Save sck/0fb893cc8fb2e6d1693d0c985a332419 to your computer and use it in GitHub Desktop.
perceptual loss: VGG + mse
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def perceptual_loss(x): | |
m_vgg(opt_img_v) | |
outs = [V(o.features) for o in sfs] | |
losses = [gram_mse_loss(o, s) for o,s in zip(outs, targ_styles)] | |
cnt_loss = F.mse_loss(outs[3], targ_vs[3])*1000000 | |
style_loss = sum(losses) | |
return cnt_loss + style_loss |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment