Изображение печати кодировщика stylegan слишком маленькое - PullRequest
1 голос
/ 29 мая 2020

Я пытаюсь напечатать изображение кодировщика stylemix, но мои напечатанные изображения слишком маленькие, я не уверен, где я делаю не так.

мое скрытое пространство

jon = np.load('latent_representations/example0.npy')
drogo = np.load('latent_representations/example1.npy')
# Loading already learned latent directions
smile_direction = np.load('ffhq_dataset/latent_directions/smile.npy')
gender_direction = np.load('ffhq_dataset/latent_directions/gender.npy')
age_direction = np.load('ffhq_dataset/latent_directions/age.npy'

)

мое сочетание стилей рисования l oop

def draw_style_mixing_figure(png, Gs, w, h, src_dlatents, dst_dlatents, style_ranges):
print(png)
#src_dlatents = Gs.components.mapping.run(src_latents, None) # [seed, layer, component]
#dst_dlatents = Gs.components.mapping.run(dst_latents, None)
src_images = Gs.components.synthesis.run(src_dlatents, randomize_noise=False, **synthesis_kwargs)
dst_images = Gs.components.synthesis.run(dst_dlatents, randomize_noise=False, **synthesis_kwargs)

canvas = PIL.Image.new('RGB', (w * (len(src_dlatents) + 1), h * (len(dst_dlatents) + 1)), 'white')
for col, src_image in enumerate(list(src_images)):
    canvas.paste(PIL.Image.fromarray(src_image, 'RGB'), ((col + 1) * w, 0))
for row, dst_image in enumerate(list(dst_images)):
    canvas.paste(PIL.Image.fromarray(dst_image, 'RGB'), (0, (row + 1) * h))
    row_dlatents = np.stack([dst_dlatents[row]] * len(src_dlatents))
    row_dlatents[:, style_ranges[row]] = src_dlatents[:, style_ranges[row]]
    row_images = Gs.components.synthesis.run(row_dlatents, randomize_noise=False, **synthesis_kwargs)
    for col, image in enumerate(list(row_images)):
        canvas.paste(PIL.Image.fromarray(image, 'RGB'), ((col + 1) * w, (row + 1) * h))
canvas.save(png)
return canvas.resize((512,512))

мой порядок печати изображений tflib.init_tf ( ) synt_kwargs = dict (output_transform = dict (func = tflib.convert_images_to_uint8, nchw_to_nhwc = True), minibatch_size = 1) _Gs_cache = dict ()

draw_style_mixing_figure (config. mix.png '), Gs, w = 1024, h = 1024, src_dlatents = jon.reshape ((1, 12, 512)), dst_dlatents = dro go .reshape ((1, 12, 512)), style_ranges = [range (1,1)]),

Но получаемые изображения слишком маленькие, и не понятно, как их увеличить?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...