Giter Site home page Giter Site logo

I had trained a styleGAN in my dataset, but in this ckpt, we miss the key named 'latent_avg', how to get it? about encoder4editing HOT 3 CLOSED

omertov avatar omertov commented on August 26, 2024
I had trained a styleGAN in my dataset, but in this ckpt, we miss the key named 'latent_avg', how to get it?

from encoder4editing.

Comments (3)

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

To add to @omertov's answer, when you initialize the network in the following lines:

# Initialize network
self.net = pSp(self.opts).to(self.device)

you can add the following snippet:

if self.net.latent_avg is None:			
    self.net.latent_avg = self.net.decoder.mean_latent(int(1e5))[0].detach()

This will estimate the average latent and store it as part of the network. Then training can continue as is normal.

from encoder4editing.

omertov avatar omertov commented on August 26, 2024

Hi @ssxxx1a.
The average latent is obtained from sampling many (usually thousands) of latent codes and averaging them to get the average code.
Usually the repositories provide a build in function for obtaining this average code, for example see this function in rosinality's repository.

After obtaining the average code, you should save it as a part of the checkpoint under the 'latent_avg' key.

Best,
Omer

from encoder4editing.

ssxxx1a avatar ssxxx1a commented on August 26, 2024

ohhh!
thanks both for your reply !

from encoder4editing.

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.