YuvalNirkin / fsgan

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

failed to swap when image to image(master) #84

Closed ooyamatakehisa closed 3 years ago

ooyamatakehisa commented 3 years ago

Thank you for your great job!!!

The following error is shown on my terminal. I also tried faceswapping using v1 (v1 branch) and then it succeeded. So this may not be because of my source or target image. Please tell me how to solve it!

Thankyou!

[ERROR:0] global /home/ooyamatakehisa/fsgan/inference/opencv-4.3.0/modules/videoio/src/cap.cpp (142) open VIDEOIO(CV_IMAGES): raised OpenCV exception:

OpenCV(4.3.0) /home/ooyamatakehisa/fsgan/inference/opencv-4.3.0/modules/videoio/src/cap_images.cpp:253: error: (-5:Bad argument) CAP_IMAGES: can't find starting number (in the name of file): /home/ooyamatakehisa/data/source/source.jpg in function 'icvExtractPattern'

Traceback (most recent call last):
  File "swap.py", line 504, in <module>
    main(**vars(parser.parse_args()))
  File "swap.py", line 498, in main
    face_swapping(source[0], target[0], output, select_source, select_target)
  File "swap.py", line 239, in __call__
    source_cache_dir, source_seq_file_path, _ = self.cache(source_path)
  File "/home/ooyamatakehisa/fsgan/preprocess/preprocess_video.py", line 446, in cache
    self.face_detector(input_path, det_file_path)
  File "/home/ooyamatakehisa/face_detection_dsfd/face_detector.py", line 64, in __call__
    raise RuntimeError('Failed to read video: ' + input_path)
RuntimeError: Failed to read video: /home/ooyamatakehisa/data/source/source.jpg

After this, I tried faceswapping with mp4 using latest model(master branch) and I got same error so it doesn't matter if source and target is images or mp4. Command I execute was this: python3 swap.py ~/data/source/source.mp4 -t ~/data/target/target.mp4 -o ~/data/a/ --finetune --finetune_save --seg_remove_mouth

ooyamatakehisa commented 3 years ago

I don't know why this error occured, but after I reinstall all library swapping was sucecessfully done. Thanks.