GithubHelp home page GithubHelp logo

stelabou / stylegan_directions_face_reenactment Goto Github PK

View Code? Open in Web Editor NEW
48.0 48.0 5.0 12.1 MB

Authors official PyTorch implementation of the "Finding Directions in GAN’s Latent Space for Neural Face Reenactment" [BMVC 2022].

Python 96.59% C++ 0.48% Cuda 2.94%

stylegan_directions_face_reenactment's People

Contributors

dedkamaroz avatar stelabou avatar

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

Watchers

 avatar  avatar  avatar  avatar

stylegan_directions_face_reenactment's Issues

Missing key(s) in state_dict in the run_facial_editing.py file

COMMAND:
python3 run_facial_editing.py --source_path ./images/selfie4.jpg --output_path ./output/facial_editing --directions 0 1 2 3 4 --image_resolution 1024 --dataset_type ffhq --save_images --optimize_generator

OUTPUT:
creating the FLAME Decoder
trained model found. Load /home/ubuntu/stylegan_directions_face_reenactment/libs/DECA/data/deca_model.tar
----- Load generator from ./pretrained_models/stylegan2-ffhq-config-f_1024.pt -----
----- Load A matrix from ./pretrained_models/A_matrix.pt -----
Linear Direction matrix-A in w+ space: input dimension 15, output dimension 512, shift dimension 512
----- Load e4e encoder from ./pretrained_models/e4e-voxceleb.pt -----
Traceback (most recent call last):
File "run_facial_editing.py", line 315, in
inference.run_editing()
File "run_facial_editing.py", line 217, in run_editing
self.load_models(inversion)
File "run_facial_editing.py", line 98, in load_models
self.encoder.load_state_dict(ckpt['e'])
File "/home/ubuntu/miniconda3/envs/python38/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1051, in load_state_dict
raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for Encoder4Editing:
Missing key(s) in state_dict: "styles.14.convs.0.weight", "styles.14.convs.0.bias", "styles.14.convs.2.weight", "styles.14.convs.2.bias", "styles.14.convs.4.weight", "styles.14.convs.4.bias", "styles.14.convs.6.weight", "styles.14.convs.6.bias", "styles.14.convs.8.weight", "styles.14.convs.8.bias", "styles.14.convs.10.weight", "styles.14.convs.10.bias", "styles.14.linear.weight", "styles.14.linear.bias", "styles.15.convs.0.weight", "styles.15.convs.0.bias", "styles.15.convs.2.weight", "styles.15.convs.2.bias", "styles.15.convs.4.weight", "styles.15.convs.4.bias", "styles.15.convs.6.weight", "styles.15.convs.6.bias", "styles.15.convs.8.weight", "styles.15.convs.8.bias", "styles.15.convs.10.weight", "styles.15.convs.10.bias", "styles.15.linear.weight", "styles.15.linear.bias", "styles.16.convs.0.weight", "styles.16.convs.0.bias", "styles.16.convs.2.weight", "styles.16.convs.2.bias", "styles.16.convs.4.weight", "styles.16.convs.4.bias", "styles.16.convs.6.weight", "styles.16.convs.6.bias", "styles.16.convs.8.weight", "styles.16.convs.8.bias", "styles.16.convs.10.weight", "styles.16.convs.10.bias", "styles.16.linear.weight", "styles.16.linear.bias", "styles.17.convs.0.weight", "styles.17.convs.0.bias", "styles.17.convs.2.weight", "styles.17.convs.2.bias", "styles.17.convs.4.weight", "styles.17.convs.4.bias", "styles.17.convs.6.weight", "styles.17.convs.6.bias", "styles.17.convs.8.weight", "styles.17.convs.8.bias", "styles.17.convs.10.weight", "styles.17.convs.10.bias", "styles.17.linear.weight", "styles.17.linear.bias".

ENVIRONMENT:
Lambdalabs cloud gpu server
Ubuntu 20.04.1
Nvidia A10 24GB VRAM
Python 3.8.0

Thank you

Incorrect path found in the config_models.py file for both FFHQ models

https://github.com/StelaBou/stylegan_directions_face_reenactment/blame/33a1f141c41de6fd740d2c313c5ffa476f997d94/libs/configs/config_models.py#L19

The following path is in the file for both FFHQ entries:

'/home/stella/Desktop/projects/Finding_Directions_Reenactment/pretrained_models/stylegan2-ffhq-config-f_1024.pt'

I assume it should be:
'./pretrained_models/stylegan2-ffhq-config-f_1024.pt'


This results in the following error stack:

----- Load generator from /home/stella/Desktop/projects/Finding_Directions_Reenactment/pretrained_models/stylegan2-ffhq-config-f_1024.pt -----
Traceback (most recent call last):
File "run_facial_editing.py", line 315, in
inference.run_editing()
File "run_facial_editing.py", line 217, in run_editing
self.load_models(inversion)
File "run_facial_editing.py", line 74, in load_models
self.generator.load_state_dict(torch.load(self.gan_weights)['g_ema'], strict = True)
File "/home/ubuntu/miniconda3/envs/python38/lib/python3.8/site-packages/torch/serialization.py", line 581, in load
with _open_file_like(f, 'rb') as opened_file:
File "/home/ubuntu/miniconda3/envs/python38/lib/python3.8/site-packages/torch/serialization.py", line 230, in _open_file_like
return _open_file(name_or_buffer, mode)
File "/home/ubuntu/miniconda3/envs/python38/lib/python3.8/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: '/home/stella/Desktop/projects/Finding_Directions_Reenactment/pretrained_models/stylegan2-ffhq-config-f_1024.pt'


If I replace the error line with the path I assumed is correct, download this model file, append "_1024" to the end of the file name and place the file in the './pretrained_models/' folder; I can then run 'run_facial_editing.py' and this model is loaded successfully.

Unfortunately another error comes up (I will raise another issue record).
Thank you

Error with image preprocessing

When I use "Face reenactment (self or cross)" with my png and mp4, sometimes it raise "Error with image preprocessing" when "Run reenactment for xxxx images". Is this a problem with my input video

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.