OpenTalker / SadTalker

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

生成视频报错 #571

Open liuxy56 opened 1 year ago

liuxy56 commented 1 year ago

使用秋叶的启动器安装sadtalker插件然后下载模型后,生成视频报错 WARNING: The new version of the model will be updated by safetensor, you may need to download it mannully. We run the old version of the checkpoint this time! {'wav2lip_checkpoint': 'E:\developer\AI\AI_Painting\sd-webui-aki-v4.2\extensions\SadTalker\checkpoints\wav2lip.pth', 'audio2pose_checkpoint': 'E:\developer\AI\AI_Painting\sd-webui-aki-v4.2\extensions\SadTalker\checkpoints\auido2pose_00140-model.pth', 'audio2exp_checkpoint': 'E:\developer\AI\AI_Painting\sd-webui-aki-v4.2\extensions\SadTalker\checkpoints\auido2exp_00300-model.pth', 'free_view_checkpoint': 'E:\developer\AI\AI_Painting\sd-webui-aki-v4.2\extensions\SadTalker\checkpoints\facevid2vid_00189-model.pth.tar', 'path_of_net_recon_model': 'E:\developer\AI\AI_Painting\sd-webui-aki-v4.2\extensions\SadTalker\checkpoints\epoch_20.pth', 'dir_of_BFM_fitting': 'E:\developer\AI\AI_Painting\sd-webui-aki-v4.2/extensions/SadTalker/src/config', 'audio2pose_yaml_path': 'E:\developer\AI\AI_Painting\sd-webui-aki-v4.2/extensions/SadTalker/src/config\auido2pose.yaml', 'audio2exp_yaml_path': 'E:\developer\AI\AI_Painting\sd-webui-aki-v4.2/extensions/SadTalker/src/config\auido2exp.yaml', 'use_safetensor': False, 'mappingnet_checkpoint': 'E:\developer\AI\AI_Painting\sd-webui-aki-v4.2\extensions\SadTalker\checkpoints\mapping_00229-model.pth.tar', 'facerender_yaml': 'E:\developer\AI\AI_Painting\sd-webui-aki-v4.2/extensions/SadTalker/src/config\facerender.yaml'} C:\Users\刘\AppData\Local\Temp\gradio\tmp8h2z2muw.png Traceback (most recent call last): File "E:\developer\AI\AI_Painting\sd-webui-aki-v4.2\python\lib\site-packages\gradio\routes.py", line 422, in run_predict output = await app.get_blocks().process_api( File "E:\developer\AI\AI_Painting\sd-webui-aki-v4.2\python\lib\site-packages\gradio\blocks.py", line 1323, in process_api result = await self.call_function( File "E:\developer\AI\AI_Painting\sd-webui-aki-v4.2\python\lib\site-packages\gradio\blocks.py", line 1051, in call_function prediction = await anyio.to_thread.run_sync( File "E:\developer\AI\AI_Painting\sd-webui-aki-v4.2\python\lib\site-packages\anyio\to_thread.py", line 31, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "E:\developer\AI\AI_Painting\sd-webui-aki-v4.2\python\lib\site-packages\anyio_backends_asyncio.py", line 937, in run_sync_in_worker_thread return await future File "E:\developer\AI\AI_Painting\sd-webui-aki-v4.2\python\lib\site-packages\anyio_backends_asyncio.py", line 867, in run result = context.run(func, args) File "E:\developer\AI\AI_Painting\sd-webui-aki-v4.2\modules\call_queue.py", line 14, in f res = func(args, **kwargs) File "E:\developer\AI\AI_Painting\sd-webui-aki-v4.2/extensions/SadTalker\src\gradio_demo.py", line 96, in test first_coeff_path, crop_pic_path, crop_info = self.preprocess_model.generate(pic_path, first_frame_dir, preprocess, True, size) File "E:\developer\AI\AI_Painting\sd-webui-aki-v4.2/extensions/SadTalker\src\utils\preprocess.py", line 96, in generate x_full_frames, crop, quad = self.propress.crop(x_full_frames, still=True if 'ext' in crop_or_resize.lower() else False, xsize=512) File "E:\developer\AI\AI_Painting\sd-webui-aki-v4.2/extensions/SadTalker\src\utils\croper.py", line 131, in crop raise 'can not detect the landmark from source image' TypeError: exceptions must derive from BaseException 提示:Python 运行时抛出了一个异常。请检查疑难解答页面。

image

请问各位大佬,这个是什么原因

liuxy56 commented 1 year ago

换了张图片就可以了,但是不知道为什么

JaxH commented 1 year ago

换张图片后还会有提示问题吗? File "D:\AI\Code\SadTalker\src\utils\preprocess.py", line 96, in generate x_full_frames, crop, quad = self.propress.crop(x_full_frames, still=True if 'ext' in crop_or_resize.lower() else False, xsize=512) ValueError: too many values to unpack (expected 3)

lynkco03787 commented 7 months ago

这个警告是由imageio_ffmpeg库中的FFmpeg写入器引发的。警告消息指示输入图像的尺寸不是宏块大小(macro_block_size)的整数倍。为了确保视频与大多数编解码器和播放器兼容,FFmpeg写入器将调整图像的尺寸。

为了修正这个问题,你可以采取以下措施之一:

调整输入图像的尺寸:将输入图像的宽度和高度调整为宏块大小(通常为16)的整数倍。这可以通过缩放图像的尺寸来实现,确保宽度和高度都是16的倍数。

设置宏块大小为1:在使用FFmpeg写入器时,可以将宏块大小设置为1,这样就不会对图像进行调整。但要注意,这可能导致视频不兼容某些编解码器和播放器。

具体来说,你可以在使用FFmpeg写入器时设置macro_block_size参数,将其设置为1,或者在调整图像尺寸时,确保宽度和高度是宏块大小的整数倍。

以下是调整图像尺寸的示例代码:

python 复制 import cv2

def resize_image(image, macro_block_size): height, width = image.shape[:2] new_width = (width // macro_block_size) macro_block_size new_height = (height // macro_block_size) macro_block_size resized_image = cv2.resize(image, (new_width, new_height)) return resized_image

调整图像尺寸为宏块大小的整数倍

resized_image = resize_image(image, macro_block_size) 请注意,上述代码使用了OpenCV库中的cv2.resize()函数来调整图像的尺寸。你需要将image替换为你的输入图像,macro_block_size替换为宏块大小的值(通常为16)。

通过这些修正措施,你应该能够消除警告并确保视频的兼容性。

换图片可行,那应该就是上述的问题,可能需要检查文件尺寸是否合适