nolan-dev / GANInterface

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

Convert .pkl files from official implementation to .pb files that can be loaded by this tool #3

Closed nolan-dev closed 4 years ago

nolan-dev commented 5 years ago

Loose plan:

  1. add ops like this to the official implementation
  2. load a pkl file, save using a method like this
  3. rename and resize the following lists in the tool: https://github.com/nolan-dev/GANInterface/blob/master/GanStudio/GanStudio/LatentManipulator.cs#L154 https://github.com/nolan-dev/GANInterface/blob/master/GanStudio/GanStudio/LatentManipulator.cs#L167
nathanshipley commented 5 years ago

Nvidia published a link to their models on Drive if you need a .PKL file to play with.

As I understand it, the networks and models are handled by their dnnlib.tflib.network script. It gets opened back up with pickle.load as shown in one example here.

Really appreciate you looking at this.

net2cn commented 4 years ago

Hi, I have done some magnificent breakthroughs in converting the original .pkl model to the .pb one (which is simply a frozen model) in one of my personal experiments. The frozen model can be used in inference with TensorFlow.NET. Based on this, I have successfully converted the .pb model to .json model for TensorFlow.js and get it running in a browser. I suggest you investigate this repo for more info (since I was inspired by this repo).

Here's the online demo of the tfjs implementation hosted on GitHub Pages by one of my friends: this repo.

nolan-dev commented 4 years ago

Thanks for the pointers. I have a way to convert but it's really hacky right now, so I might check out that repo if I can't find a quick way to clean it up. Check out https://github.com/nolan-dev/GANInterface/issues/4#issuecomment-588662983 for more info.

nolan-dev commented 4 years ago

Added (a messy) way to convert from pkl to a format readable by the tool here: https://github.com/nolan-dev/GANInterface/tree/master/pkl_conversion