Coder Social home page Coder Social logo

Comments (5)

yuval-alaluf avatar yuval-alaluf commented on May 27, 2024

Hi @zerollzeng ,
First, please note that the implementation for the generator was taken from rosinality.

With that said, in our repo we provide code that you can adopt for generating random samples using our pSp network and StyleGAN generator. Specifically, please refer to our inference.py script for an implementation for generating a random latent vector that we use for style mixing here:

# get latent vector to inject into our input image
vec_to_inject = np.random.randn(1, 512).astype('float32')
_, latent_to_inject = net(torch.from_numpy(vec_to_inject).to("cuda"),
input_code=True,
return_latents=True)

Although here we only store latent_to_inject, you can make a few changes that will store the generated corresponding random face image for the random latent vector.

For example, the following code should be a good starting point for your needs:

n_images_to_generate = 10
generated_images = []
for _ in range(n_images_to_generate):
        random_vec = np.random.randn(1, 512).astype('float32')
        random_image, _ = net(torch.from_numpy(random_vec).to("cuda"), input_code=True, return_latents=True)
        generated_images.append(random_image)

Here, we generate random w vectors which are fed into pSp to randomly generate face images of size 256x256.

Please let me know if this is clear and if you have further questions.

from pixel2style2pixel.

zerollzeng avatar zerollzeng commented on May 27, 2024

Oh thanks for your detailed explanation, I understand it now ::smile::
I'm reading your paper and code, doing some experiment, your jobs is fantastic! I think it would be great if we keep this issue open so that we can continue the discussion instead of open a new issue 👍

from pixel2style2pixel.

zerollzeng avatar zerollzeng commented on May 27, 2024

I'm going to train your encoder network from scratch, here are some question I'm interested:

  1. What's the difference between GradualStyleEncoder, BackboneEncoderUsingLastLayerIntoW, and BackboneEncoderUsingLastLayerIntoWPlus?
  2. Does the num_layer's (50, 100, 152) affect the reconstruct result a lot?

from pixel2style2pixel.

yuval-alaluf avatar yuval-alaluf commented on May 27, 2024

Thank you for the kind words!
Regarding your questions:

  1. These architectures refer to official pSp encoder, the Naive W+ encoder, and W Encoder mentioned in the paper, respectively. The pSp architecture is explained in Section 3 in the paper and is illustrated in Figure 2. For an explanation of the two later architectures, please refer to the results shown in Section 4.1 (StyleGAN Inversion) in the paper where we discuss the ablation study performed.
  2. In our experiments, we did not change the num_layers from the default value of 50. That is, in all experiments, we use a pretrained IR-SE50 model (which we linked in the README).

Please let me know if you have further questions.

from pixel2style2pixel.

yuval-alaluf avatar yuval-alaluf commented on May 27, 2024

Closing due to inactivity.

from pixel2style2pixel.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.