Git Product home page Git Product logo

Comments (5)

bes-dev avatar bes-dev commented on May 22, 2024 3

@zuimeiyujianni so, we improve user experience a little bit. Just do like:

$ git clone https://github.com/bes-dev/MobileStyleGAN.pytorch.git && cd MobileStyleGAN.pytorch
$ gdown https://drive.google.com/uc?id=1PQutd-JboOCOZqmd95XWxWrO8gGEvRcO
$ python convert_rosinality_ckpt.py --ckpt 550000.pt --ckpt-mnet mnet.ckpt --ckpt-snet snet.ckpt --cfg-path config.json
$ python demo.py --cfg config.json --ckpt "" --generator teacher

It works well for me.

from mobilestylegan.pytorch.

bes-dev avatar bes-dev commented on May 22, 2024 2

It works correct on my side. For exmaple 550000.pt:
Screenshot from 2021-08-11 20-33-39

from mobilestylegan.pytorch.

TechSheng avatar TechSheng commented on May 22, 2024 2

Thank you for your reply! I use the latest code in your MobileStyleGAN repository. However, I can't generate sharp images. Can you share your local "convert_rosinality_ckpt.py" file with me? or the converted ckpt file? I want to find the reason.

from mobilestylegan.pytorch.

bes-dev avatar bes-dev commented on May 22, 2024 2

@zuimeiyujianni I just do something like this:

  • clone latest version of MobileStyleGAN.pytorch
    git clone https://github.com/bes-dev/MobileStyleGAN.pytorch.git && cd MobileStyleGAN.pytorch
  • downnload 550000.pt
    gdown https://drive.google.com/uc?id=1PQutd-JboOCOZqmd95XWxWrO8gGEvRcO
  • convert 550000.pt to internal format:
    python convert_rosinality_ckpt.py --ckpt 550000.pt --ckpt-mnet mnet.ckpt --ckpt-snet snet.ckpt
  • create config.json:
{
    "logger": {
        "type": "NeptuneLogger",
        "params": {
            "offline_mode": true,
            "project_name": "bes-dev/stylegan2_compression",
            "experiment_name": "baseline"
        }
    },
    "trainset": {
        "emb_size": 512,
        "n_batches": 10000
    },
    "valset": {
        "emb_size": 512,
        "n_batches": 200
    },
    "teacher": {
        "mapping_network": {
            "name": "mnet.ckpt"
        },
        "synthesis_network": {
            "name": "snet.ckpt"
        }
    },
    "distillation_loss": {
        "perceptual_size": 256,
        "loss_weights": {
            "l1": 1.0,
            "l2": 1.0,
            "loss_p": 1.0,
            "loss_g": 0.5
        }
    },
    "trainer": {
        "monitor": "kid_val",
        "monitor_mode": "min",
        "style_mean": 4096,
        "style_mean_weight": 0.5,
        "num_workers": 0,
        "lr_student": 5e-4,
        "lr_gan": 5e-4,
        "batch_size": 2,
        "max_epochs": 100,
        "mode": "g,d",
        "reg_d_interval": 16,
        "truncated": false
    }
}
  • run compare.py demo:
python compare.py --cfg config.json --ckpt ""

So, you should see the correct images generated by StyleGAN2 on the left (and noise on the right, because your MobileStyleGAN model is not trained yet)

from mobilestylegan.pytorch.

TechSheng avatar TechSheng commented on May 22, 2024 1

Thank you for your reply!!!. I have overcome this problem.

from mobilestylegan.pytorch.

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.