xrenaa / StyleSpace-pytorch

Implementation of StyleSpace Analysis: Disentangled Controls for StyleGAN Image Generation in PyTorch
99 stars 14 forks source link

Input images #4

Closed vinduon closed 3 years ago

vinduon commented 3 years ago

Hi!

How can I input an image and manipulate its eye gaze? This repo is only for random noise?

xrenaa commented 3 years ago

Hi, you need GAN inversion techniques to invert the image to latent space. You can refer to: https://github.com/eladrich/pixel2style2pixel

vinduon commented 3 years ago

thank you sir! You saved my life

vinduon commented 3 years ago

Screenshot from 2021-06-30 11-35-00

I will invert the image to latent space with this shape [1,512] and then use your code to generate it. Is that true? Or I have to train it?

xrenaa commented 3 years ago

Hi, Actually, as I know, the latest work will give you a [18, 512] code instead of a [1, 512] one and then you can input this one into the generator. You do not need to train it. You may need to take care that you may need to trasfer the 18, 512 tensor to a list of 18 tensor of shape [1, 512]

vinduon commented 3 years ago

Hi, Actually, as I know, the latest work will give you a [18, 512] code instead of a [1, 512] one and then you can input this one into the generator. You do not need to train it. You may need to take care that you may need to trasfer the 18, 512 tensor to a list of 18 tensor of shape [1, 512]

As I see that you have an encoder model in folder stylegan2, is that what you will use to make inversion? I am new in this domain.

xrenaa commented 3 years ago

As I see that you have an encoder model in folder stylegan2, is that what you will use to make inversion? I am new in this domain.

Yes. This can be used as a simple inversion. If you want to use this simple encoder, you need to train it.

vinduon commented 3 years ago

Thank you sir! I will try to implement one. If I meet some problems, could I come back to this and ask you?

xrenaa commented 3 years ago

Thank you sir! I will try to implement one. If I meet some problems, could I come back to this and ask you?

Hi, I am happy to help you when I am free.

Zhangxinnian commented 2 years ago

@xrenaa @duongquangvinh Hello, I'm very sorry to disturb you. I want to ask you a question.I use this (https://github.com/rosinality/stylegan2-pytorch/) project in the projector.py to generate latent. The shape is [18,512], but I can't get the effect of changing the style in the text. What should I do with this (I use latent = latent.unsqueeze(0) here). I saw that it is mentioned in the article that the inversion is generated by encoder-based, and I am not using encoder-based, will this have an impact? Looking forward to your reply, thank you!