PDillis / stylegan3-fun

Modifications of the official PyTorch implementation of StyleGAN3. Let's easily generate images and videos with StyleGAN2/2-ADA/3!
Other
230 stars 36 forks source link

Would it be possible to render a video from projected W? #23

Open georgeguida opened 2 years ago

georgeguida commented 2 years ago

I would like to generate a video from a projected w vector and specify the number of frames between this interpolation. The current image generator permits the option to ==projected-w, however, this does not seem possible for video. Is this currently possible?

Describe the solution you'd like Project images as npz file (vs npy) -> combine multiple vectors into a single npz file -> generate interpolation video between projected images.

Describe alternatives you've considered Resembles this generator - https://github.com/dvschultz/stylegan2-ada-pytorch/blob/main/generate.py, or the colab : https://colab.research.google.com/github/dvschultz/stylegan2-ada-pytorch/blob/main/SG2_ADA_PyTorch.ipynb#scrollTo=4cgezYN8Dsyh

@ !python generate.py --process=interpolation --interpolation=linear --easing=easeInOutQuad --space=w --network=/content/ladiesblack.pkl --outdir=/content/combined-proj/ --projected-w=/content/npz/combined.npz --frames=120

Amazing set of features! Thank you @PDillis

PDillis commented 2 years ago

It can be done, but have you also tried using that file in this repository directly (changing its name and just removing everything else)? If it doesn't run, what errors do you get? Will look into it still!

georgeguida commented 2 years ago

Tested it out, however stylegan2 ada pytorch and stylegan 3 .pkl files are different

Input : !python generate.py --process=interpolation --interpolation=linear \ --easing=easeInOutQuad --space=w \ --network=/notebooks/training-runs/00007-stylegan3-t-dataset_dalle-gpus2-batch32-gamma8/network-snapshot-000600.pkl \ --outdir=/notebooks/out_generator \ --projected-w=/notebooks/projector/00000-projection-w-wavgstart-sgan2/projected_wavg_final.npy \ --frames=200

Error: /notebooks/stylegan3-fun/generate.py:59: SyntaxWarning: "is not" with a literal. Did you mean "!="? elif(len(seeds) is not 3): Loading networks from "/notebooks/training-runs/00007-stylegan3-t-dataset_dalle-gpus2-batch32-gamma8/network-snapshot-000600.pkl"... Traceback (most recent call last): File "/notebooks/stylegan3-fun/generate.py", line 492, in generate_images() # pylint: disable=no-value-for-parameter File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1130, in call return self.main(args, kwargs) File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1055, in main rv = self.invoke(ctx) File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1404, in invoke return ctx.invoke(self.callback, ctx.params) File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 760, in invoke return __callback(args, *kwargs) File "/usr/local/lib/python3.9/dist-packages/click/decorators.py", line 26, in new_func return f(get_current_context(), args, kwargs) File "/notebooks/stylegan3-fun/generate.py", line 408, in generate_images G = legacy.load_network_pkl(f, custom=custom, G_kwargs)['G_ema'].to(device) # type: ignore TypeError: load_network_pkl() got an unexpected keyword argument 'custom'

Thanks for your response 👍