mganprior
mganprior copied to clipboard
How to use Multi-Code method for StyleGAN?
Hi, in derivable_generator.py, several configurations are listed. However, there is no multi-code configuration for StyleGAN. In fact, StyleGAN's design is different from pggan, where w is inserted into each middle layers of the generator by AdaIN. How to use multi-code scheme in StyleGAN scenario?
def get_derivable_generator(gan_model_name, generator_type, args):
if generator_type == 'PGGAN-z': # Single latent code
return PGGAN(gan_model_name)
elif generator_type == 'StyleGAN-z':
return StyleGAN(gan_model_name, 'z')
elif generator_type == 'StyleGAN-w':
return StyleGAN(gan_model_name, 'w')
elif generator_type == 'StyleGAN-w+':
return StyleGAN(gan_model_name, 'w+')
elif generator_type == 'PGGAN-Multi-Z': # Multiple Latent Codes
return PGGAN_multi_z(gan_model_name, args.composing_layer, args.z_number, args)
else:
raise Exception('Please indicate valid `generator_type`')
Same issue!
Hi, @yue95213 and @zhufeida. Thank you for your question. It worth noticing that the stylegan has multi-code design natively (the style code for each layer) and the stylegan-w+ is for the inversion using these codes. Use multi-code strategy on stylegan is equivalent to an over-parameterization version of stylegan-w+ inversion. So in the released code, we recommend using stylegan-w+.
What parameters you are using for invert stylegan? I use
python multi_code_inversion.py --gan_model stylegan_bedroom
--target_images ./examples/gan_inversion/bedroom
--outputs ./gan_inversion_bedroom2
--inversion_type StyleGAN-w+
However, the results are not very realistic. What parameters should I use?
What parameters you are using for invert stylegan? I use
python multi_code_inversion.py --gan_model stylegan_bedroom --target_images ./examples/gan_inversion/bedroom --outputs ./gan_inversion_bedroom2 --inversion_type StyleGAN-w+However, the results are not very realistic. What parameters should I use?
Have you tried on face images? How does the face experiment work?
And try to use Norm initialization. The initialization method is influential for stylegan.
python multi_code_inversion.py
--gan_model stylegan2_ffhq
--target_images ./examples/face
--outputs ./gan_inversion_face
--composing_layer 8
--z_number 20
--iterations 3000
--inversion_type StyleGAN-w+
--init_type Normal
--optimization Adam
--loss_type VGG
Traceback (most recent call last):
File "multi_code_inversion.py", line 112, in
@Xiaomao136 Hello, have you solved this bug?
Please refer to genforce/idinvert project, I switched to genforce/idinvert project
liuliuliu11 [email protected] 于2020年10月9日周五 下午4:47写道:
@Xiaomao136 https://github.com/Xiaomao136 Hello, have you solved this bug?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/genforce/mganprior/issues/3#issuecomment-706055461, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMU4MTFFQ22ENHNWNQVB663SJ3E3NANCNFSM4MEXG7SA .
@JasonGUTU using stylegan_w+ for face is still far from ideal, can you show that how to split stylegan? I did that following PGGAN-Multi-Z, but it reported error that in x = self.epilogue(x, w), the shape of w is desired to be [1, 512], but actually [1, 18, 512], I've no idea what happened.