Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update need and add Windows compatibility #14

Closed
mykeehu opened this issue Sep 22, 2022 · 1 comment
Closed

Update need and add Windows compatibility #14

mykeehu opened this issue Sep 22, 2022 · 1 comment

Comments

@mykeehu
Copy link

mykeehu commented Sep 22, 2022

Hello,
Your code need updat here:

  • in model.py, line 19:
    old code:
    self.resnet = resnet18(pretrained=True)
    new code:
    self.resnet = resnet18(weights='ResNet18_Weights.DEFAULT')

  • in invert.py, line 19:
    old code:
    perceptual = torchvision.models.vgg16(pretrained=True)
    new code:
    perceptual = torchvision.models.vgg16(weights='VGG16_Weights.DEFAULT')

And your code not Windows compatible. Need install Visual Studio Community edition and add PATH this line (where have cl.exe):

  • for Windows x64: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\bin\Hostx64\x64
  • for Windows x86: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\bin\Hostx64\x86

I then created a testimages folder with an in and an out subfolder. I put in a JPG image and ran the test. This is what I got:
J:\StyleCariGAN-master>test.py --ckpt checkpoint\StyleCariGAN\001000.pt --input_dir testimages\in --output_dir testimages\out --invert_images optimizing w optimizing w: loss_pixel: 0.4483; loss_feature: 4.0835: 100%|█| 250/250 [00:23< optimizing wp optimizing wp: loss_pixel: 0.2393; loss_feature: 2.2942: 100%|█| 2000/2000 [04: Traceback (most recent call last): File "J:\StyleCariGAN-master\test.py", line 120, in <module> invert(g_ema.photo_generator, perceptual, photo, device, args) File "J:\StyleCariGAN-master\invert.py", line 341, in invert torch.save(result, args.result_dir + f'/{args.image_name}.pt') File "C:\Users\Mykee\miniconda3\lib\site-packages\torch\serialization.py", line 376, in save with _open_file_like(f, 'wb') as opened_file: File "C:\Users\Mykee\miniconda3\lib\site-packages\torch\serialization.py", line 230, in _open_file_like return _open_file(name_or_buffer, mode) File "C:\Users\Mykee\miniconda3\lib\site-packages\torch\serialization.py", line 211, in __init__ super(_open_file, self).__init__(open(name, mode)) FileNotFoundError: [Errno 2] No such file or directory: 'testimages\\in/testimages\\in\\20200913_124752.pt'

The .pt file(s) has not been generated or saved, so it cannot be found. How can I fix this?

@wonjongg
Copy link
Owner

wonjongg commented Nov 8, 2022

It seems that the path separator (delimiter) is differently defined according to the operating system (Windows: , Linux: /). Please check the path separator carefully. :-)

@wonjongg wonjongg closed this as completed Nov 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants