YuvalNirkin / fsgan

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

AssertionError: Failed to read frame #32

Closed jblee4sphinx closed 4 years ago

jblee4sphinx commented 4 years ago

Hello, I get this error at the end of processing swap.py. Is there a fix for this? Thank you!

Process FaceSwappingRenderer-1: Traceback (most recent call last): File "/root/anaconda3/lib/python3.7/multiprocessing/process.py", line 297, in _bootstrap self.run() File "/data/dev/projects/fsgan/utils/video_renderer.py", line 159, in run assert frame_bgr is not None, f'Failed to read frame {i} from input video: "{self._in_vid_path}"' AssertionError: Failed to read frame 1253 from input video: "../docs/examples/

YuvalNirkin commented 4 years ago

It seems to me that "../docs/examples/.mp4" is not an actual path to a video. What is the full command you used?

jblee4sphinx commented 4 years ago

I removed the video filename prior to pasting. Here's the full command being run. The path is relative, similarly to how you did the shinzo and conan examples. I copied my source and target videos into the same directory with examples.

(base) root@ip-10-0-10-227:/data/dev/projects/fsgan/inference# python swap.py ../docs/examples/source_video.mp4 -t ../docs/examples/target_video.mp4 -o . --finetune --finetune_save --seg_remove_mouth

YuvalNirkin commented 4 years ago

Try re-encoding both videos with a standard encoding:

ffmpeg -i <input video> -r 25 <output video>
jblee4sphinx commented 4 years ago

I finished re-encoding but now retrying the swap.py gives me an Assertion Error with CUDA. File "/data/dev/projects/face_detection_dsfd/face_detector.py", line 19, in init assert torch.cuda.is_available(), 'CUDA must be available!' AssertionError: CUDA must be available!

Is there a fix for this?

YuvalNirkin commented 4 years ago

Did you install the CUDA toolkit and NVIDIA driver?

jblee4sphinx commented 4 years ago

Yes. I followed every command step-by-step from https://github.com/YuvalNirkin/fsgan/wiki/Ubuntu-Installation-Guide. I will just rebuild and start over. Thanks for the help.

ghost commented 4 years ago

I had the same issue and can confirm that re-encoding both videos fixed the problem.

harrodjordan commented 3 years ago

I'm having this issue and re-encoding is not fixing the problem. Is there another workaround?