stelabou / stylegan_directions_face_reenactment Goto Github PK
View Code? Open in Web Editor NEWAuthors official PyTorch implementation of the "Finding Directions in GAN’s Latent Space for Neural Face Reenactment" [BMVC 2022].
Authors official PyTorch implementation of the "Finding Directions in GAN’s Latent Space for Neural Face Reenactment" [BMVC 2022].
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
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
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.