williamyang1991 / DualStyleGAN

[CVPR 2022] Pastiche Master: Exemplar-Based High-Resolution Portrait Style Transfer
Other
1.61k stars 249 forks source link

Train with w-plus pSp encoder. #87

Open RewindL opened 1 year ago

RewindL commented 1 year ago

I'm wondering if this repository can be trained with w-plus pSp encoder since original pSp is designed to predict wplus latent code from input image. I have read the DualStyleGAN code, and I found when wplus encoder is employed during training DualStyleGAN, it will work for destylezation if I change z_plus_latent=True ot z_plus_latent=False, which means latent need not be projected by decoder.style (the 8-layer-MLP of stylegan2) anymore. But when pretraining/finetuning DualStyleGAN, random styles are sampled by torch.randn limiting these styles are from Z+ space, and should be projected by decoder.style when injected into nework. So I have no plan to train with w-plus encoder, and I want to ask you if there is any solution or I must train z-plus pSp first? Your reply will be appreciated.

williamyang1991 commented 1 year ago

DualStyleGAN can be trained with wplus encoder. All you need to do is to revise the code everywhere it calls z_plus_latent=True and transforms zplus code to wplus code. And all the training and testing processes should use wplus instead of zplus.

RewindL commented 1 year ago

Thanks for your early reply, I will try to train model following your advice.