今天在调试应用EchoMimic的时候,运行webui脚本,应用报错了,部分错误信息如下:
Traceback (most recent call last):
File “D:\python\EchoMimic\myenv\lib\site-packages\anyio_backends_asyncio.py”, line 2441, in run_sync_in_worker_thread
return await future
File “D:\python\EchoMimic\myenv\lib\site-packages\anyio_backends_asyncio.py”, line 943, in run
result = context.run(func, args) File “D:\python\EchoMimic\myenv\lib\site-packages\gradio\utils.py”, line 846, in wrapper response = f(args, **kwargs)
File “D:\python\EchoMimic\gradio_app.py”, line 34, in infer_a2v
path_video = infer(
File “D:\python\EchoMimic\my_infer_audio2vid.py”, line 214, in infer
face_img = cv2.resize(face_img, (width, height))
cv2.error: OpenCV(4.10.0) :-1: error: (-5:Bad argument) in function ‘resize’
Overload resolution failed:
- src is not a numerical tuple
- Expected Ptrfor argument ‘src’
意思是传递给cv2.resize的不是有效的图像数组数据,原代码如下:
face_img = crop_and_pad(face_img, crop_rect)
face_mask = crop_and_pad(face_mask, crop_rect)
face_img = cv2.resize(face_img, (width, height))
face_mask = cv2.resize(face_mask, (width, height))
代码修改方式如下:
face_img,_ = crop_and_pad(face_img, crop_rect)
face_mask,_ = crop_and_pad(face_mask, crop_rect)
face_img = cv2.resize(face_img, (width, height))
face_mask = cv2.resize(face_mask, (width, height))
问题解决,不再报错