GithubHelp home page GithubHelp logo

vinairesearch / hyperinverter Goto Github PK

View Code? Open in Web Editor NEW
113.0 5.0 13.0 4.42 MB

HyperInverter: Improving StyleGAN Inversion via Hypernetwork (CVPR 2022)

Home Page: https://di-mi-ta.github.io/HyperInverter/

License: Apache License 2.0

Python 86.20% C++ 2.81% Cuda 10.07% Shell 0.92%
cvpr2022 gan-inversion generative-adversarial-network image-interpolation image-manipulation stylegan-encoder stylegan-inversion stylegan2 stylegan2-ada

hyperinverter's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

hyperinverter's Issues

When try with different images loss not going down as low as in the given INVERTME.png

Hi, Thank you for the great tutorial about GAN invention, I am new to this topic.

I just checked the inversion and rebuilding of a different image of size 256x256 from the ffhq dataset. But it stops at 0.5 mse loss. What may be the reason for that and How can I avoid it and make it generate like the given INVERTME.png image.

Thanks in advance

ModuleNotFoundError: No module named 'dnnlib.tflib'

Hi, I am getting the following error when try to run the inference script, I did complete all the installation steps without an error

Traceback (most recent call last):
  File "scripts/inference.py", line 91, in <module>
    run()
  File "scripts/inference.py", line 34, in run
    net = HyperInverter(opts)
  File "./models/hyper_inverter.py", line 58, in __init__
    self.load_weights()
  File "./models/hyper_inverter.py", line 99, in load_weights
    ckpt = pickle.load(f)
ModuleNotFoundError: No module named 'dnnlib.tflib'

Problem testing inference

Trying to run inference on Windows:
Installed all requirements without any error, but I do get one when try to run inference:

(HyperInverter) H:\AI\HyperInverter>python scripts/inference.py --exp_dir=./results --checkpoint_path=./pretrained_models/hyper_inverter_e4e_ffhq_encode_large.pt --data_path=./data --batch_size= 4 --workers=4
C:\Users\GIN\.conda\envs\HyperInverter\lib\site-packages\torch\utils\cpp_extension.py:287: UserWarning: Error checking compiler version for cl: [WinError 2] Impossibile trovare il file specificato
  warnings.warn('Error checking compiler version for {}: {}'.format(compiler, error))
INFORMAZIONI: impossibile trovare file corrispondenti ai
criteri di ricerca indicati.
Traceback (most recent call last):
  File "scripts/inference.py", line 14, in <module>
    from models.hyper_inverter import HyperInverter  # noqa: E402
  File ".\models\hyper_inverter.py", line 10, in <module>
    from models.encoders import fpn_encoders
  File ".\models\encoders\fpn_encoders.py", line 5, in <module>
    from models.stylegan2.model import EqualLinear
  File ".\models\stylegan2\model.py", line 5, in <module>
    from models.stylegan2.op import FusedLeakyReLU, fused_leaky_relu, upfirdn2d
  File ".\models\stylegan2\op\__init__.py", line 1, in <module>
    from .fused_act import FusedLeakyReLU, fused_leaky_relu
  File ".\models\stylegan2\op\fused_act.py", line 14, in <module>
    os.path.join(module_path, "fused_bias_act_kernel.cu"),
  File "C:\Users\GIN\.conda\envs\HyperInverter\lib\site-packages\torch\utils\cpp_extension.py", line 997, in load
    keep_intermediates=keep_intermediates)
  File "C:\Users\GIN\.conda\envs\HyperInverter\lib\site-packages\torch\utils\cpp_extension.py", line 1202, in _jit_compile
    with_cuda=with_cuda)
  File "C:\Users\GIN\.conda\envs\HyperInverter\lib\site-packages\torch\utils\cpp_extension.py", line 1293, in _write_ninja_file_and_build_library
    with_cuda=with_cuda)
  File "C:\Users\GIN\.conda\envs\HyperInverter\lib\site-packages\torch\utils\cpp_extension.py", line 1689, in _write_ninja_file_to_build_library
    with_cuda=with_cuda)
  File "C:\Users\GIN\.conda\envs\HyperInverter\lib\site-packages\torch\utils\cpp_extension.py", line 1791, in _write_ninja_file
    'cl']).decode().split('\r\n')
  File "C:\Users\GIN\.conda\envs\HyperInverter\lib\subprocess.py", line 395, in check_output
    **kwargs).stdout
  File "C:\Users\GIN\.conda\envs\HyperInverter\lib\subprocess.py", line 487, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['where', 'cl']' returned non-zero exit status 1.

Is it possible to convert image to different domain?

THank you for your great work.
Is to possible to convert image to different domain and not using latent directions to change latect codes?
For example, pSp can generate a front-facing face from a given input image and generate photo-realistic face images from ambiguous sketch images

I am wondering HyperInverter can do the samething?

If it is possilbe, should I modeified your codes? or I just need to change data path?

Looking forward to your reply.

擷取

confused with some code.

Hi, sorry to bother you again. I find some code in class WeightRegressor like:

  out = torch.matmul(out, self.w1) + self.b1
  out = out.view(bs, self.in_channels, self.hidden_dim)
  out = torch.matmul(out, self.w2) + self.b2
  kernel = out.view(bs, self.out_channels, self.in_channels, self.kernel_size, self.kernel_size)  # like bz, 512, 512, 3, 3

why not use linear layer, like

w1 = nn.Linear(128, 65536)
w2 = nn.Linear(65536, 2359296)
out = w1(out)
out = w2(out)
kernel = out.view(bs, self.out_channels, self.in_channels, self.kernel_size, self.kernel_size)

girl have beard

You really did a great job. Thanks for sharing. When test some image, I found when person become old, person will wear glass, some girl have beard. How to solve that?
screenshot-20220616-104340
8b927126db85d175fb8cf6b69724579d

It seems exits much noise on face in some images

Hi, thank you for your great work. When I test on many images, I found comes several defect as follows:

  1. It seems exits much noise on face in some images(zoom in)
    orgin image: tbqorg (2)
    invert image:
    tbqinv (2)

  2. It seems sensitive to hair on the face:
    origin image:
    tbqorg (3)
    invert image:
    tbqinv (3)

Can you give me some advise to solve that?

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.