stylegan2-pytorch icon indicating copy to clipboard operation
stylegan2-pytorch copied to clipboard

Can I project the image to latent space in this model?

Open VincentWu1997 opened this issue 2 years ago • 3 comments

I want to project some images into latent spaces and use the latent space as input to generate new images. Can I finish this using the demo? Thanks!

VincentWu1997 avatar Apr 19 '22 09:04 VincentWu1997

The projection results you get by directly projecting to the latent space is usually of poor quality and of low similarity to the source. If your use case is able to utilize the (18,512) shaped latents instead of the (1,512) then I'd recommend using this : https://github.com/omertov/encoder4editing. It gives significantly higher quality results than direct projection. Hope this is helpful.

JohnnyRacer avatar Apr 19 '22 19:04 JohnnyRacer

I don't see any treatment when the Z-space is used, though:

https://github.com/rosinality/stylegan2-pytorch/blob/bef283a1c24087da704d16c30abc8e36e63efa0e/ppl.py#L97

@rosinality could you comment?

sayakpaul avatar Feb 22 '23 09:02 sayakpaul

You can use pSp to train an image encoder that project image into stylegan2 Z+ latent space or W+ latent space.

RewindL avatar Jul 31 '23 02:07 RewindL