Giter VIP home page Giter VIP logo

Comments (11)

yuval-alaluf avatar yuval-alaluf commented on August 23, 2024 2

Note that the number of style vectors can be computed by
n_styles = int(math.log(output_size, 2)) * 2 - 2
For example, for a 1024x1024 output resolution we have 18 style vectors while for a resolution of 256x256 we have 14 style vectors.

from pixel2style2pixel.

yuval-alaluf avatar yuval-alaluf commented on August 23, 2024 1

Hi @jis478 ,
Yes this is definitely possible!
Notice that in psp_encoder.py we have the following line:

You can change this line to have whatever number of latents you need.

Just make sure that if you load the average latent, you repeat the vector the correct number of times. That is, you need to adjust the following line:

self.__load_latent_avg(ckpt, repeat=18)

There may be some other small modifications that you may need to do, but this should help you get started.

from pixel2style2pixel.

xjw00654 avatar xjw00654 commented on August 23, 2024 1

I have tested another stylegan2 implementation by Tetratrio. It just take a little modification of the codes (just replace the Generator class).

from pixel2style2pixel.

yuval-alaluf avatar yuval-alaluf commented on August 23, 2024 1

The final missing piece here; do you also support the more recent Pytorch implementation of Stylegan2-ADA-pytorch? The authors indicate that it is compatible with pickles from the old repo but I don't know if it works the other way around.

We actually haven't tried it, but I feel like it won't work out-of-the-box because the names of the model parameters will most likely be different than what is used in rosinality's pytorch stylegan implementation (which is what we use here).
However, if you replace the Generator class used in this repository with the Generator used in Stylegan2-ADA-pytorch I believe it should work.

from pixel2style2pixel.

berylsheep-up avatar berylsheep-up commented on August 23, 2024

Hello, @yuval-alaluf ! What if I want to use another stylegan weights ranther than the specific stylegan2 weights? Because I found the code is only for stylegan2 model. Would I use the official stylegan weights to train the psp?

from pixel2style2pixel.

yuval-alaluf avatar yuval-alaluf commented on August 23, 2024

The StyleGAN model that you use must be compatible with rosinality's StyleGAN implementation. Therefore, you may use models that are trained using either:

  1. rosinality's pytorch repository
  2. NVIDIA's official tensorflow respository (https://github.com/NVlabs/stylegan2 or https://github.com/NVlabs/stylegan2-ada) and are then converted to pytorch using rosinality's conversion script.

from pixel2style2pixel.

yuval-alaluf avatar yuval-alaluf commented on August 23, 2024

Thanks for the input @xjw00654 !
Based on this, you may find it possible to use weights from different sources by making the necessary adjustments to the code.
I am closing this issue for now as I believe the question has been answered.

from pixel2style2pixel.

rafaelbou avatar rafaelbou commented on August 23, 2024

Hi everyone!
I'm also trying to train pSp on my own dataset (not faces).
@jis478 how did you calculate the number of the style count, why for 256 image size the style count is 14?

In general, I'll be happy for any conclusions form your training experience.

Thanks :)

from pixel2style2pixel.

markemus avatar markemus commented on August 23, 2024

The final missing piece here; do you also support the more recent Pytorch implementation of Stylegan2-ADA-pytorch? The authors indicate that it is compatible with pickles from the old repo but I don't know if it works the other way around.

from pixel2style2pixel.

markemus avatar markemus commented on August 23, 2024

I tested a stylegan2-ada-pytorch pickle and it doesn't work with rosinality's conversion script unfortunately- it crashes trying to load from torch_utils (which only exists in the stylegan2-ada-pytorch repo). Oh well :)

I will see if I can get the Generator approach working instead.

from pixel2style2pixel.

yuval-alaluf avatar yuval-alaluf commented on August 23, 2024

I tested a stylegan2-ada-pytorch pickle and it doesn't work with rosinality's conversion script unfortunately- it crashes trying to load from torch_utils (which only exists in the stylegan2-ada-pytorch repo). Oh well :)

I will see if I can get the Generator approach working instead.

Right. The conversion script will work on the tensorflow code for StyleGAN2 and ADA. But for the new pytorch code more changes will be needed. Looking forward to an update if you get it to work!

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.