jcjohnson / neural-style

Torch implementation of neural style algorithm
MIT License
18.31k stars 2.7k forks source link

Optimizations #63

Open vidda13 opened 9 years ago

vidda13 commented 9 years ago

Firstly, Great work!!. What are the possible optimizations I can do to improve the performance of this algorithm?

jcjohnson commented 9 years ago

What do you want to optimize? Runtime? On CPU or GPU? Memory usage? Make results look nicer?

vidda13 commented 9 years ago

Runtime on GPU and Memory usage

jcjohnson commented 9 years ago

Make sure you are running the latest NVIDIA drivers, and using cuDNN R3. You can also try changing the cuDNN algorithm; by using different cudnn algorithm modes for different layers you may be able to tweak speed and memory usage. As a start you can try the cudnn auto-tuning mode by adding the line cudnn.benchmark = true after you import cudnn. Getting the best results here will depend on what GPU you are using and the size of the input image.

Another thing you could try is to use the VGG-16 rather than the VGG-19 used by default; I haven't tried it but I think it should give similar results, while being a bit faster and taking less memory. However you might have to play with the optimization hyperparameters a bit to get good results.

vidda13 commented 9 years ago

Ok. Thanks. Algorithm wise how else can I improve the performance. I tried using VGG16 layers and adam optimizer instead of normalised VGG and lbfgs optimizer. I got a pretty good performance improvement but the quality wasn't as great but still reasonable.

hlgkb commented 7 years ago

How about making the result look more nicer? Results from DeepArt.io and DeepDreamGenerator look great. Is there anyway we can generate same level result using this implementation?