Neural-Zoom icon indicating copy to clipboard operation
Neural-Zoom copied to clipboard

Debugging folder and some improvements

Open kyeshmz opened this issue 5 years ago • 5 comments

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 avatar Mar 12 '20 06:03 kyeshmz

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

kyeshmz avatar Mar 12 '20 07:03 kyeshmz

@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 avatar Mar 12 '20 22:03 ProGamerGov

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).

ProGamerGov avatar Mar 12 '20 23:03 ProGamerGov

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.

kyeshmz avatar Mar 13 '20 06:03 kyeshmz

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

ProGamerGov avatar Mar 13 '20 17:03 ProGamerGov