seeprettyface-generator-wanghong icon indicating copy to clipboard operation
seeprettyface-generator-wanghong copied to clipboard

怎么用生成码 dlatent?

Open athenawisdoms opened this issue 5 years ago • 1 comments

请问该怎么与generator_wanghong_hd.pkl一起使用生成码 dlatent?

如果使用 generator_wanghong_hd.pkl,它会绘制错误的图像

# http://www.seeprettyface.com/generate_code/Fanbingbing.npy
dlatent= np.load('Fanbingbing.npy')
model_path = 'generator_wanghong_hd.pkl'

synthesis_kwargs = dict(output_transform=dict(func=tflib.convert_images_to_uint8, nchw_to_nhwc=True), minibatch_size=1)
with dnnlib.util.open_url(model_path) as f:
    _G, _D, Gs = pickle.load(f)

img = Gs.components.synthesis.run(dlatent.reshape((-1, 18, 512)), randomize_noise=False, **synthesis_kwargs)[0]
plt.imshow(img)
plt.axis('off')
plt.show()

image

只有使用 karras2019stylegan-ffhq-1024x1024.pkl 时才会绘制正确的图像

# http://www.seeprettyface.com/generate_code/Fanbingbing.npy
dlatent= np.load('Fanbingbing.npy')
model_path = 'karras2019stylegan-ffhq-1024x1024.pkl'

synthesis_kwargs = dict(output_transform=dict(func=tflib.convert_images_to_uint8, nchw_to_nhwc=True), minibatch_size=1)
with dnnlib.util.open_url(model_path) as f:
    _G, _D, Gs = pickle.load(f)

img = Gs.components.synthesis.run(dlatent.reshape((-1, 18, 512)), randomize_noise=False, **synthesis_kwargs)[0]
plt.imshow(img)
plt.axis('off')
plt.show()

image

athenawisdoms avatar Sep 18 '19 23:09 athenawisdoms

你好,Fanbingbing.npy是用官方生成器训练出来的,所以只能搭配karras2019stylegan-ffhq-1024x1024.pkl才能还原哦。如果想用generator_wanghong_hd.pkl,得搭配用网红脸生成器找到的生成码才行。

a312863063 avatar Oct 01 '19 01:10 a312863063