PDillis / stylegan3-fun

Modifications of the official PyTorch implementation of StyleGAN3. Let's easily generate images and videos with StyleGAN2/2-ADA/3!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Specify latent space variables in generate.py

ajerschow opened this issue · comments

It was not clear to me how I could specify the latent space variables to generate.py, because it seems you can only provide a seed. Can I provide arguments or ranges to generate.py corresponding to the two latent space variables that one can control in visualizer.py?
Thank you & sorry if this is an obvious question.

Hello! Sorry for not seeing this before.

generate.py lets you either generate images/grid of images (python generate.py images ...) or videos (python generate.py {random-video/circular-video} ...). Each have their own set of parameters you can set in order to get what you want. I'm not sure what you mean with the two latent space variables in visualizer.py. Do you mean seed and style mixing, or the truncation? If it's anything to do with style mixing, then that's what style_mixing.py is for. For the other two, they have available settings/commands in generate.py.

Let me know! I haven't fully documented this, so for sure it's not an obvious question.

Ah, I see what you mean. I haven't added any of this to the scripts, as these are heuristics on the GUI on how to interpolate between seeds. As you click and drag the mouse, you are slowly interpolating/changing the seeds, so you could check the code to see how this is explicitly done over at viz/latent_widget.py.

So, if you want to interpolate between seeds with my scripts, you should check sightseeding.py. You won't have the minute level of control from the GUI, as honestly it's done for 2D interactions with the latent space (i.e., the screen), which doesn't translate well to the command line. However, I believe I give a lot of usability in how you interpolate between them, so I hope it's useful for you as well. I provide some examples in my previous repo here.

If you are interested in a specific frame of the video, you could then use ffmpeg to extract all frames and select the one you want. Some examples can be found here. Let me know if you have other issues/questions!

Thank you, that clears it up!