williamyang1991 / DualStyleGAN

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

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

Closed goldwater668 closed 1 year ago

goldwater668 commented 1 year ago

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呢

williamyang1991 commented 1 year ago

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

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