Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query: StyleGAN2 latent_seed #345

Open
KomputerMaster64 opened this issue Sep 2, 2022 · 3 comments
Open

Query: StyleGAN2 latent_seed #345

KomputerMaster64 opened this issue Sep 2, 2022 · 3 comments

Comments

@KomputerMaster64
Copy link

KomputerMaster64 commented Sep 2, 2022

Respected sir
Thank you for sharing the projects and the pre-trained models. I have been trying to use the StyleGAN2 notebook. I want to generate multiple random samples, but the latent_seed command is limiting the results. I wanted to ask how to generate a grid of random results.

I am sharing the link to the cell I want to refer to here.

@TakuyaYashima
Copy link
Contributor

Thanks for using our Colab demo.

Unfortunately the link is not working properly, so we don't know which cell you mention, but if you mention the cell for simple image generation (the cell after Now let's run StyleGAN2! ), you cannot make a grid image as is. You need to edit the cell.
Can you tell us what kind of grid images you want? We can let you know how to then.

Or, the cell for style mixing, you can make grid image by, for example, specifying batch_size_A = 3 and batch_size_B = 3 in the configuration cell. The resulting image should be like the following.

image

@KomputerMaster64
Copy link
Author

Thank you for the response.
I wanted to know if I have saved some images in a directory using the model, how can I make the grid of N*M dimensions from them for analysing the results.

@TakuyaYashima
Copy link
Contributor

Sorry for the late reply! You might have already found the solution, but hope this can help (very primitive way though). Should work on Colab (or they provide some convenient ways!)

import numpy as np
from nnabla.utils.image_utils import imread, imsave

filepaths = [
             [filepath00, filepath01, filepath02, ...],
             [filepath10, filepath11, filepath12, ...],
             [filepath20, filepath21, filepath22, ...],
             ]  # specify image paths
assert len(set([len(_) for _ in filepaths])) == 1
imgs = list()

for row in range(filepaths):
    imgs.append(np.concatenate([imread(_, size=(256, 256)) for _ in row], axis=1))
    # axis=0 is vertical, axis=1 is horizontal
grid_imgs = np.concatenate([img for img in imgs], axis=0)

imsave(savepath, grid_imgs)  # specify saving image paths

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants