bryandlee / stylegan2-encoder-pytorch

PyTorch Implementation of In-Domain GAN Inversion for StyleGAN2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

About the latent.shape

ruanjiyang opened this issue · comments

Hi Bryandlee

thanks for your greate work!

I tried your Domain-Guided Encoder and get the latent (z0) with the shape [1,14,512]

but when I tried the offical stylegan2-pytorch project.py and get the latent with the shape[1,512].

so I really confused. from my understanding, the latent shape is always like [1,512]. so why this 14 coming in your encoder? thanks!

Hi, the [1, 512]-shaped latent corresponds to the original W space where [1, 14, 512]-shaped latent corresponds to the expanded W+ space. W+ space uses different w vectors for each conv layer for more representation power. The stylegan2-pytorch project.py has --w_plus flag for it.

Hi, the [1, 512]-shaped latent corresponds to the original W space where [1, 14, 512]-shaped latent corresponds to the expanded W+ space. W+ space uses different w vectors for each conv layer for more representation power. The stylegan2-pytorch project.py has --w_plus flag for it.

Thanks very much for your feedback.

According to my understanding, The stylegan2-pytorch project.py has --w_plus flag for it and the shape is [1,18,512], not [1,14,512].

Is that possible to generate normal [1,512] latent from your stylegan2-encoder-pytorch?

Thanks again!

The exact shape of w+ depends on the number of layers, which is determined by the image size. I think [1, 18, 512] is for 1024x1024 images.

You can modify the output shape of the encoder to be [1, 512] in model.py, but the model should be trained again.

I would suggest checking out other recent models (psp, e4e) as well, although these also use w+ latents instead of the original w.

Hope this helps!