StelaBou / stylegan_directions_face_reenactment

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

您好,在Face reenactment (self or cross):的时候报错了 #5

Closed laura990501 closed 1 month ago

laura990501 commented 1 month ago

python run_inference.py --source_path ./inference_examples/0002775.png --target_path ./inference_examples/lWOTF8SdzJw#2614-2801.mp4 --output_path ./results/ --save_video creating the FLAME Decoder trained model found. Load /home/jianghanyu/lyujiayi/stylegan_directions_face_reenactment/libs/DECA/data/deca_model.tar ----- Load generator from ./pretrained_models/stylegan-voxceleb.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 ----- ** Start optimization for 200 steps ** 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████| 200/200 [00:05<00:00, 36.40it/s] ** End optimization ** Extract frames with 1 fps Run reenactment for 187 images Traceback (most recent call last): File "run_inference.py", line 328, in main() File "run_inference.py", line 323, in main inference.run_reenactment() File "run_inference.py", line 169, in run_reenactment params_source, angles_source = calculate_shapemodel(self.shape_model, source_img) File "/home/jianghanyu/lyujiayi/stylegan_directions_face_reenactment/libs/utilities/generic.py", line 27, in calculate_shapemodel p_tensor, alpha_shp_tensor, alpha_exp_tensor, angles, cam = deca_model.extract_DECA_params(img_tmp) # params dictionary File "/home/jianghanyu/lyujiayi/stylegan_directions_face_reenactment/libs/DECA/estimate_DECA.py", line 38, in extract_DECA_params image_prepro, error_flag = self.data.get_image_tensor(images[batch].clone()) File "/home/jianghanyu/lyujiayi/stylegan_directions_face_reenactment/libs/DECA/decalib/datasets/datasets.py", line 61, in get_image_tensor bbox, bbox_type = self.face_detector.run(img_tmp) File "/home/jianghanyu/lyujiayi/stylegan_directions_face_reenactment/libs/DECA/decalib/datasets/detectors.py", line 34, in run out = self.model.get_landmarks(image) File "/home/jianghanyu/miniconda3/envs/stylegan_reenactment/lib/python3.8/site-packages/face_alignment/api.py", line 89, in get_landmarks return self.get_landmarks_from_image(image_or_path, detected_faces) File "/home/jianghanyu/miniconda3/envs/stylegan_reenactment/lib/python3.8/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "/home/jianghanyu/miniconda3/envs/stylegan_reenactment/lib/python3.8/site-packages/face_alignment/api.py", line 108, in get_landmarks_from_image detected_faces = self.face_detector.detect_from_image(image.copy()) File "/home/jianghanyu/miniconda3/envs/stylegan_reenactment/lib/python3.8/site-packages/face_alignment/detection/sfd/sfd_detector.py", line 44, in detect_from_image bboxlist = detect(self.face_detector, image, device=self.device)[0] File "/home/jianghanyu/miniconda3/envs/stylegan_reenactment/lib/python3.8/site-packages/face_alignment/detection/sfd/detect.py", line 26, in detect return batch_detect(net, img, device) File "/home/jianghanyu/miniconda3/envs/stylegan_reenactment/lib/python3.8/site-packages/face_alignment/detection/sfd/detect.py", line 43, in batch_detect img_batch = img_batch - torch.Tensor([104, 117, 123]).view(1, 3, 1, 1) RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!