williamyang1991 / DualStyleGAN

[CVPR 2022] Pastiche Master: Exemplar-Based High-Resolution Portrait Style Transfer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

我想使用生成的风格图像进行风格迁移,应该如何操作呢?

goldwater668 opened this issue · comments

https://github.com/williamyang1991/DualStyleGAN/blob/main/notebooks/inference_playground.ipynb
在上述的Step 7: Perform Inference -- Artistic Portrait Generation
我想用其中的一张风格图像作为外部风格迁移,应该如何做呢?
latent = torch.tensor(exstyles[stylename]).to(device)
if args.preserve_color and not args.wplus:
latent[:, 7:18] = instyle[:, 7:18]
# extrinsic styte code
exstyle = generator.generator.style(latent.reshape(latent.shape[0] * latent.shape[1], latent.shape[2])).reshape(
latent.shape)
如何修改 latent呢

Step 7: Perform Inference -- Artistic Portrait Generation
save你要想用的风格图片对应的exstyle

在# extrinsic styte code这个地方
直接load exstyle即可