Closed dongyun-kim-arch closed 3 years ago
I managed to get the latent vector of my input image and move this vector to some feature's direction, but couldn't figure out the way to reconstruct an image from changed vectors.
You can gett the reconstruction by passing the modified latent to the generator. Something like this:
images, _ = self.generator([sample_latents], randomize_noise=False, input_is_latent=True)
Also, in style_mixing.py, why do you inject random vectors into input image which is totally unrelated to each other??
When performing style mixing in segmentation-to-image for example, you want to generate multiple images all with the same structure (e.g., head shape and hairstyle), but different color schemes. How do we get these different color schemes? By first randomly sampling many vectors and then mixing them to the latent code of the sketch image in the "fine" input layers of StyleGAN2.
In the snippet you tried pasting this is the overall flow:
N
vectors (i.e., to generate N
style-mixed outputs)
b. For each random vector v
sampled above:
v
.res
.Hope this helps
Thanks for your answer!
I tried images, _ = self.generator(sample_latents, randomize_noise=False, input_islatent=True) not images, = self.generator([sample_latents], randomize_noise=False, input_is_latent=True)
and your explanation makes so sense to me. Thanks again!
I am trying to extract latent vector from my input image which is 18, 512 dim and want to manipulate this image based on certain features such as age or gender.
I managed to get the latent vector of my input image and move this vector to some feature's direction, but couldn't figure out the way to reconstruct an image from changed vectors.
It seems you imported stylegan2 generator as a decoder and do something, but I am stuck in this point...
Also, in style_mixing.py, why do you inject random vectors into input image which is totally unrelated to each other?? Random vector is used for current vector, but couldn't understand the overall workflow...
for image_idx, input_image in enumerate(input_batch):
generate random vectors to inject into input image