nolan-dev / GANInterface

Tool to interface with a StyleGAN model
Apache License 2.0
217 stars 25 forks source link

Add compilation instructions / release compiled version? #1

Open aydao opened 4 years ago

aydao commented 4 years ago

Hello! Could you update the readme with instructions for compiling the GANStudio executable? Or, would you be willing to drop your compiled exe in a release tab in this repo? I'd love to try this out but I'm at a loss for getting the projects compiled.

For additional context on what I've tried so far (I'm doing this on Windows 7 x64 with Visual Studio 2019, and I'm honestly not familiar with it at all...): I loaded and compiled each of the different solutions for TensorflowInterface, GanTools, and GanStudio in turn. Compiling GanStudio does create an executable but it throws an error. I figured out I needed a graph.pb and related StyleGAN checkpoint, so I put that in the bin folder alongside the executable. That seemed to work, but a new error indicated GanTools.dll was missing a required dll (Exception thrown: 'System.ArgumentException' in GanTools.dll ...I don't know how to get more verbose debug messages). I guessed it needed the TensorflowInterface.dll, which itself needed a Tensorflow.dll (I acquired one, unsure if it is the right version or if that matters at all), and I dropped all of those in the same folder as the GanStudio.exe. Anyway, that didn't work so I'm pretty much stuck. Hopefully I am just doing something foolish and there's a simple solution. I think I have the correct .NET framework version 4.7.2 and AVX enabled, if that matters.

nolan-dev commented 4 years ago

Yeah sorry, this definitely needs better instructions, I'm planning on updating it more over the next week or so. I wouldn't recommend trying to build it yet.

Pretty much GanStudio (the executable) depends on GanTools, which depends on TensorflowInterface, which depends on tensorflow.dll (available in https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-windows-x86_64-1.14.0.zip). So TensorflowInterface needs to be compiled first, then GanTools, then GanStudio with the dependencies set up correctly. You shouldn't need a checkpoint, just a frozen graph.pb with layer names like in https://github.com/nolan-dev/stylegan_reimplementation. That stylegan implementation is just as messy as this tool, so if I have time I'm going to try and make it so it can load a saved .pb of the official implementation (should just need to fix the names). On top of that, it will also expect some additional data files that correspond to attribute vectors (which I should make optional).

If you have a frozen graph.pb from the official implementation and send it to me, I'll try and get it working with a compiled version and share that.

aydao commented 4 years ago

Thank you, that's a big help. I think one problem I was having was the incorrect model names. I ran into some issues running your stylegan_reimplementation repo that prevented me from generating an example model/checkpoint.

I also noticed a question about releasing a sample model (https://github.com/nolan-dev/stylegan_reimplementation/issues/1). If possible, that would help out a lot in debugging this repo on my end. Thanks again for the quick response!

nolan-dev commented 4 years ago

I'll try and include a pre-trained model, most likely of the FFHQ dataset, and a compiled version of the tool soon. I updated the stylegan_reimplementation repo with an example script that works for me with the dataset I'm using, but it may require tweaking the resolution parameters to get it working with a different dataset. I'm happy to help if you run into any issues with that

nolan-dev commented 4 years ago

Here is a compiled version with a model using square anime images if you want to try it out: https://drive.google.com/drive/folders/16fAXt6VXeVHUCy5PjpW63pwKIUJ4_HsK?usp=sharing I'll be sharing this more officially when I've finished a tutorial for it, some workflows aren't intuitive. For example, if you want to change a feature map you can click or click+drag on the image to add a positive influence, right click to add a negative influence, or shift+click to remove modifications. I believe the probability of generating NSFW images is very low for this version, but it isn't zero. Let me know if you run into any issues or have questions, I appreciate any feedback. I've tested it on a basic windows server AWS instance so you can try it there if you don't use windows or run into some other issue.

aydao commented 4 years ago

Hey Nolan, thank you! The compiled version works beautifully. I'm playing around with the different features now and haven't discovered any bugs. If I do find anything major, or have questions, I'll let you know. In the meantime I'm good with this issue so feel free to close it whenever.

ad48hp commented 4 years ago

Maybe it wóuld be better to put the compiled version onto the 'Releases' category for easier finding.. ^w^ Also, could you rewrite the Python scripts with Numpy.NET ?

nolan-dev commented 4 years ago

Thanks for the suggestions, I appreciate the feedback. Completely forgot about the Releases section and I'll definitely include the compiled versions there. The reason I went with python was for iteration speed and making it extensible without needing to recompile, but it's a messy solution and Numpy.NET definitely looks useful.

nolan-dev commented 4 years ago

FYI I added compilation instructions for the latest version to the readme and uploaded a pre-release version here: https://github.com/nolan-dev/GANInterface/releases/tag/v0.2.0-alpha

ad48hp commented 4 years ago

Nice work, it quite is like a faster version of Make.Girls.Moe! (Even though i'm not in the target audience probably as i "infinitely" yet prefer videos to static images) So far the basic generation works w/o problems only the design of the program is a bit generic, shall i give it a try to redesign it ?

nolan-dev commented 4 years ago

I'd certainly appreciate any design help, but due to the current design being messy/poorly documented (and being actively changed) it might be hard to figure out what everything does. I'm hoping to have time to do another blog soon to go over some of the recent changes which might clarify things.