lengstrom / fast-style-transfer

TensorFlow CNN for fast style transfer ⚡🖥🎨🖼
10.92k stars 2.6k forks source link

Python error while trying to create a new style checkpoint file #123

Open LeeJenkins opened 6 years ago

LeeJenkins commented 6 years ago

I downloaded and used fast-style-transfer with pre-generated checkpoint files to create new images. It works so well that I want to train new checkpoint files from other paintings.

So after downloading & installing the imagenet-vgg-verydeep-19.mat file and the train2014 archive into the data directory, I tried to follow the command format shown on the project page. But Python crashed with an error message. Here's my command and the result:

C:\Users\leej\fast-style-transfer>python style.py --style examples\style\van-gogh-660x800.jpg --checkpoint-dir examples\checkpoint-files --test test\josey-wales-600x800.jpg --test-dir test --content-weight 1.5e1 --batch-size 20
Train set has been trimmed slightly..
(1, 800, 660, 3)
Traceback (most recent call last):
  File "style.py", line 167, in <module>
    main()
  File "style.py", line 147, in main
    for preds, losses, i, epoch in optimize(*args, **kwargs):
  File "src\optimize.py", line 34, in optimize
    net = vgg.net(vgg_path, style_image_pre)
  File "src\vgg.py", line 27, in net
    mean = data['normalization'][0][0][0]
KeyError: 'normalization'

C:\Users\leej\fast-style-transfer>

What am I doing wrong?

jorgechato commented 6 years ago

same here

kthordarson commented 6 years ago

Same for me, anyone found a fix or workaround ?

kthordarson commented 6 years ago

Turns out I had the wrong version of imagenet-vgg-verydeep-19.mat.

scanthony commented 6 years ago

Use the following version of the VGG19 file: www.vlfeat.org/matconvnet/models/beta16/imagenet-vgg-verydeep-19.mat