ajbrock / Neural-Photo-Editor

A simple interface for editing natural photos with generative neural networks.
MIT License
2.08k stars 197 forks source link

Easier option to not use cuDNN #4

Closed pvginkel closed 7 years ago

pvginkel commented 7 years ago

This project looks very interesting, but I don't have access to an nVidia card. The readme says "You'll need to uncomment my explicit DNN calls if you wish to not use it.", but if I have a look at the code, there's a lot of references to DNN, so this doesn't look very trivial.

Is it possible to create a custom version (maybe a branch?) that works without having cuDNN installed?

ajbrock commented 7 years ago

I'm looking into it--I just need to do some due dilligence to figure out the exact padding scheme that the DeconvLayers use. The issue is that I used 5x5 filters in the DeconvLayers, which I'm pretty sure means you need an imbalanced pad (i.e. one extra zero on one side) for the fractionally-strided convs, and I'm not exactly certain where that goes. Once I figure that out it should be trivial to replace it with a non-DNN TransposedConv2DLayer and a PadLayer, which should operate more-or-less equivalently.

ajbrock commented 7 years ago

I have now added support for not using cuDNN, which should enable you to run this on a non-NVIDIA GPU. Simply replace the dnn=True flag on line 64 of NPE.py with dnn=False and it should run. Feel free to let me know how this works out.

pvginkel commented 7 years ago

Got a lot further this time. It would be helpful if the instructions for installing on Windows were a bit expanded, specifically:

It then crashes on parsing IAN_simple.npz, but that was because I downloaded the ZIP and that does not include GitHub LFS files. Downloading that one directly from GitHub did solve the problem.

Must say that the performance on CPU is pretty acceptable (although I am using a 4 core Xeon 3.4 GHz, so that may help).

Thanks for the help.