rrmina / fast-neural-style-pytorch

Fast Neural Style Transfer implementation in PyTorch :art: :art: :art:
315 stars 77 forks source link

VGG weight file not available on AWS #12

Open mixuala opened 4 years ago

mixuala commented 4 years ago

got a FORBIDDEN response for the AWS file. switched to the weights file which is now included with torchvision

# !wget https://s3-us-west-2.amazonaws.com/jcjohns-models/vgg16-00b39a1b.pth
!wget https://download.pytorch.org/models/vgg16-397923af.pth
!cp vgg16-397923af.pth vgg16-00b39a1b.pth
rrmina commented 4 years ago

As far as I know, torchvision's VGG assumes RGB image input of pixel values [0,1] in contrast to the original VGG weights which assumes BGR image input with pixel values from [0,255].

Did that work out for you?

rrmina commented 4 years ago

Anyway, someone has already reported this issue to me. #10

I have uploaded the VGG16 weights here: https://drive.google.com/file/d/1a0sFcNEvmIy21PE0yp7tzJuU0vhhV0Ln/view?usp=sharing

I will also update the readme as well as the notebooks with the appropriate link.

Thank you for reporting.

mixuala commented 4 years ago

It seems to work, here's a shot of my training just before the end (below) using the pytorch weights as mentioned

What I'm confused about is how your network successfully learns without clipping the Transformer output before calculating the VGG losses. I rebuilt the same network in tensorflow, but it doesn't learn unless I do the following transforms to the output of the Transformer

Screen Shot 2020-02-08

rrmina commented 4 years ago

Interesting! Looks like it somehow worked, though I never had a result with artifacts like yours in upper right corner.

I did add the VGG means

content_features = VGG(content_batch.add(imagenet_neg_mean))
generated_features = VGG(generated_batch.add(imagenet_neg_mean))

And yeah, I am also equally confused that I did not need to use a Tanh as output layer. In fact, Tanh produced really bad looking images . Search for Ditching in my README