OpenTalker / SadTalker

[CVPR 2023] SadTalker:Learning Realistic 3D Motion Coefficients for Stylized Audio-Driven Single Image Talking Face Animation
https://sadtalker.github.io/
Other
12.03k stars 2.24k forks source link

cv2.error: OpenCV(4.6.0) : -1: error: (-5:Bad argument) in function 'cvtColor' #673

Open nemoiee opened 1 year ago

nemoiee commented 1 year ago

Excuse me. I have a problem when I run the program in Linux with command

python inference.py --driven_audio ./examples/driven_audio/RD_Radio31_000.wav --source_image ./examples/source_image/full_body_1.png --result_dir ./results --still --preprocess full --enhancer gfpgan

The program is stopped, and give a hint


using safetensor as default
3DMM Extraction for source image
landmark Det:: 100%|██████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 17.94it/s]
3DMM Extraction In Video:: 100%|██████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 68.38it/s]
mel:: 100%|████████████████████████████████████████████████████████████████████████████████████████████████| 200/200 [00:00<00:00, 52379.69it/s]
audio2exp:: 100%|██████████████████████████████████████████████████████████████████████████████████████████████| 20/20 [00:00<00:00, 395.15it/s]
Face Renderer:: 100%|█████████████████████████████████████████████████████████████████████████████████████████| 100/100 [00:05<00:00, 18.93it/s]
The generated video is named ./results/2023_10_11_02.26.23/full_body_1##RD_Radio31_000.mp4
OpenCV: FFMPEG: tag 0x5634504d/'MP4V' is not supported with codec id 12 and format 'mp4 / MP4 (MPEG-4 Part 14)'
OpenCV: FFMPEG: fallback to use tag 0x7634706d/'mp4v'
seamlessClone:: 100%|█████████████████████████████████████████████████████████████████████████████████████████| 200/200 [00:11<00:00, 17.89it/s]
The generated video is named ./results/2023_10_11_02.26.23/full_body_1##RD_Radio31_000_full.mp4
face enhancer....
Face Enhancer::   0%|                                                                                                    | 0/66 [00:00<?, ?it/s]
face enhancer....
Face Enhancer::   0%|                                                                                                    | 0/66 [00:00<?, ?it/s]
Traceback (most recent call last):
  File "/data/xxxxx/SadTalker/src/facerender/animate.py", line 252, in generate
    imageio.mimsave(enhanced_path, enhanced_images_gen_with_len, fps=float(25))
  File "/data/miniconda3/envs/sadtalker_py38/lib/python3.8/site-packages/imageio/v2.py", line 331, in mimwrite
    return file.write(ims, **kwargs)
  File "/data/miniconda3/envs/sadtalker_py38/lib/python3.8/site-packages/imageio/core/legacy_plugin_wrapper.py", line 188, in write
    for written, ndimage in enumerate(ndimage):
  File "/data/xxxxx/SadTalker/src/utils/face_enhancer.py", line 113, in enhancer_generator_no_len
    img = cv2.cvtColor(images[idx], cv2.COLOR_RGB2BGR)
cv2.error: OpenCV(4.6.0) :-1: error: (-5:Bad argument) in function 'cvtColor'
> Overload resolution failed:
>  - src is not a numpy array, neither a scalar
>  - Expected Ptr<cv::UMat> for argument 'src'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "inference.py", line 144, in <module>
    main(args)
  File "inference.py", line 87, in main
    result = animate_from_coeff.generate(data, save_dir, pic_path, crop_info, \
  File "/data/xxxxx/SadTalker/src/facerender/animate.py", line 254, in generate
    enhanced_images_gen_with_len = enhancer_list(full_video_path, method=enhancer, bg_upsampler=background_enhancer)
  File "/data/xxxxx/SadTalker/src/utils/face_enhancer.py", line 28, in enhancer_list
    return list(gen)
  File "/data/xxxxx/SadTalker/src/utils/face_enhancer.py", line 113, in enhancer_generator_no_len
    img = cv2.cvtColor(images[idx], cv2.COLOR_RGB2BGR)
cv2.error: OpenCV(4.6.0) :-1: error: (-5:Bad argument) in function 'cvtColor'
> Overload resolution failed:
>  - src is not a numpy array, neither a scalar
>  - Expected Ptr<cv::UMat> for argument 'src'

Thanks

nemoiee commented 1 year ago

I Change the opencv version, but the problem still exists.

nemoiee commented 1 year ago

I do some dedug, and notice that the error occur in face enhancer.

img = cv2.cvtColor(images[idx], cv2.COLOR_RGB2BGR)
yaosx425 commented 1 month ago

I do some dedug, and notice that the error occur in face enhancer.

img = cv2.cvtColor(images[idx], cv2.COLOR_RGB2BGR)

Hello, have you solved it?