YuvalNirkin / fsgan

FSGAN - Official PyTorch Implementation
https://nirkin.com/fsgan
Creative Commons Zero v1.0 Universal
752 stars 147 forks source link

Swapping still images #31

Closed apolo74 closed 1 year ago

apolo74 commented 4 years ago

Trying to test swap.py in the simplest way with two images but it crashes at the Cache input section of the FaceSwapping call function:

python swap.py ../docs/examples/source_01.png -t ../docs/examples/target_01.jpg => using GPU devices: 0 => Loading face pose model: "hopenet_robust_alpha1.pth"... => Loading face landmarks model: "hr18_wflw_landmarks.pth"... => Loading face segmentation model: "celeba_unet_256_1_2_segmentation_v2.pth"... => Loading face reenactment model: "nfv_msrunet_256_1_2_reenactment_v2.1.pth"... => Loading face completion model: "ijbc_msrunet_256_1_2_inpainting_v2.pth"... => Loading face blending model: "ijbc_msrunet_256_1_2_blending_v2.pth"... => Extracting sequences from detections in video: "source_01.png"... 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 1659.14it/s] Traceback (most recent call last): File "swap.py", line 503, in main(**vars(parser.parse_args())) File "swap.py", line 497, in main face_swapping(source[0], target[0], output, select_source, select_target) File "swap.py", line 240, in call source_cache_dir, source_seq_filepath, = self.cache(source_path) File "/home/burrito/Documents/Viktoria/MIDAS/fsgan/preprocess/preprocess_video.py", line 462, in cache self.resolution, self.crop_scale) File "/home/burrito/Documents/Viktoria/MIDAS/fsgan/preprocess/crop_image_sequences.py", line 21, in main raise RuntimeError('Cache file does not exist: ' + cache_path) RuntimeError: Cache file does not exist: ../docs/examples/source_01/source_01_dsfd_seq.pkl

however I see there is a file created at that location labeled source_01_dsdf.pkl. Is there something else I should pass as arguments to swap.py for working with single images?

YuvalNirkin commented 4 years ago

Target images are not yet supported in v2. For now you can use face_swap_images2images.py from v1.

CC-todo commented 4 years ago

Target images are not yet supported in v2. For now you can use face_swap_images2images.py from v1.

Is there a pre-trained model in the v1 version?

YuvalNirkin commented 4 years ago

Yes, please refer to this guide.

ljq-09 commented 3 years ago

Why does the image have vertical stripes after step Gr?