ProGamerGov / Neural-Zoom

Infinite Zoom For Style Transfer
MIT License
43 stars 8 forks source link

Debugging folder and some improvements #5

Open kyeshmz opened 4 years ago

kyeshmz commented 4 years ago

Hi thanks so much for the repo, its a great start for many video art with neural nets. Just wanted to branch off of this #4 I started a fork of the repo which mainly takes care of the PIL and tmp directory bugs. fork

Working with the neural-style-pt It seems I can run with adam optimizer using python neural_zoom.py -script neural_style.py -style_image examples/inputs/coral.jpg -content_image examples/inputs/mold.jpg -model_file models/vgg19-d01eb7cb.pth -backend cudnn -optimizer adam -verbose

but not with the lbfgs, as I get this error. It seems something with the neural-style script or how it handles lbfgs?

If you think there is a place I can start digging, please let me know

Capturing style target 1
Running optimization with L-BFGS
Traceback (most recent call last):
  File "neural_style.py", line 468, in <module>
    main()
  File "neural_style.py", line 262, in main
    optimizer.step(feval)
  File "/usr/local/lib/python3.6/dist-packages/torch/optim/lbfgs.py", line 354, in step
    old_dirs.pop(0)
IndexError: pop from empty list
kyeshmz commented 4 years ago

it also seems like you can't use cudnn_autotune with neuralstyle pt because the other package doesn't want it as true or false, rather just flagged

ProGamerGov commented 4 years ago

@kkshmz For the first issue, it's because of a difference between neural-style-pt and neural-style. -lbfgs_num_correction is set to zero in neural-style to disable it (and thus use the default value), while neural-style-pt uses the actual default value of 100. This change was made in neural-style-pt per this issue.

It should be pretty easy to fix, as you just have to replace the 0 with 100 here (as Torch 7 also uses 100 as the default value): https://github.com/ProGamerGov/Neural-Zoom/blob/master/neural_zoom.py#L44

ProGamerGov commented 4 years ago

I'm not sure about the -cudnn_autotune issue, as both neural-style and neural-style-pt use the parameter in the same way (as a flag with no additional input).

kyeshmz commented 4 years ago

The -cudnn_autotune issue is that all the flag arguments return out like python neural-style -cudnn_autotune True, which is not what the state_true wants for the neural-style-pt. Rather, it should just print out python neural-style -cudnn_autotune, but the it currently also prints out the value, like the rest of the params.

ProGamerGov commented 4 years ago

@kkshmz I guess a quick fix might be to check for a value after -cudnn_autotune and then remove it if there is one?