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

How can I make the latents in data_latents and latents_ in edits_sg? #4

Open
naeun0620 opened this issue Aug 4, 2022 · 0 comments
Open

Comments

@naeun0620
Copy link

naeun0620 commented Aug 4, 2022

Hi, I have a question. It would be really helpful if you answer me.

I am wondering how to make the *.npy s in data_latents and latents_ folders.

For example, If I want to make latents_/beard_glass.npy and data_latents/men.npy for edit_type 'beard', what should I save?

Is the normalized B in https://github.com/RameenAbdal/CLIP2StyleGAN/blob/main/optimize_dir.py#L85 can be latents_/beard_glass.npy?

Also, how can I make data_latents/men.npy? Can I just get all the men images and extract features like the code below?

   image_data = natsorted(glob.glob(args.path))
   with torch.no_grad():
      for i in range(len(image_data)):
         if i == 0:
            i_x = preprocess(Image.open(image_data[i])).unsqueeze(0).to(device)
            image_features_pred = model.encode_image(i_x)
         else:
            i_x = preprocess(Image.open(image_data[i])).unsqueeze(0).to(device)
            image_features_pred = torch.cat((image_features_pred, model.encode_image(i_x)),dim = 0)

Thanks,

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

1 participant