eladrich / pixel2style2pixel

Official Implementation for "Encoding in Style: a StyleGAN Encoder for Image-to-Image Translation" (CVPR 2021) presenting the pixel2style2pixel (pSp) framework
https://eladrich.github.io/pixel2style2pixel/
MIT License
3.19k stars 570 forks source link

how I get output of encoder ? W=dlatens or called W+ #11

Closed Johnson-yue closed 3 years ago

Johnson-yue commented 3 years ago

in the funtion of run_on_batch(). it only inversion image and generated fake image but not have output of image

if I want the dlatens (or W+) in FFHQ model , how I get ?

eladrich commented 3 years ago

Hi @Johnson-yue, you can take a look at the arguments for the pSp forward pass https://github.com/eladrich/pixel2style2pixel/blob/master/models/psp.py#L66 Specifically in your case, simply setting return_latents=True will make the function return a tuple of both the images and latents

images, result_latents = net(...,return_latents=True) 
Johnson-yue commented 3 years ago

thank you, I got it