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.9k stars 2.22k forks source link

while enhancing i got this error ! #555

Open daarkwulf opened 1 year ago

daarkwulf commented 1 year ago

face enhancer.... Face Enhancer:: 13%|███████▉ | 45/359 [52:10<6:04:03, 69.56s/it] face enhancer.... Traceback (most recent call last): File "F:\roop\SadTalker\src\facerender\animate.py", line 244, in generate imageio.mimsave(enhanced_path, enhanced_images_gen_with_len, fps=float(25)) File "F:\New folder\lib\site-packages\imageio\v2.py", line 331, in mimwrite return file.write(ims, *kwargs) File "F:\New folder\lib\site-packages\imageio\core\legacy_plugin_wrapper.py", line 188, in write for written, ndimage in enumerate(ndimage): File "F:\roop\SadTalker\src\utils\face_enhancer.py", line 116, in enhancer_generator_no_len cropped_faces, restored_faces, r_img = restorer.enhance( File "F:\New folder\lib\site-packages\torch\utils_contextlib.py", line 115, in decorate_context return func(args, *kwargs) File "F:\New folder\lib\site-packages\gfpgan\utils.py", line 145, in enhance restored_img = self.face_helper.paste_faces_to_input_image(upsample_img=bg_img) File "F:\New folder\lib\site-packages\facexlib\utils\face_restoration_helper.py", line 355, in paste_faces_to_input_image upsample_img = inv_soft_mask pasted_face + (1 - inv_soft_mask) * upsample_img numpy.core._exceptions._ArrayMemoryError: Unable to allocate 576. MiB for an array with shape (6144, 4096, 3) and data type float64

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "F:\New folder\lib\site-packages\gradio\routes.py", line 442, in run_predict output = await app.get_blocks().process_api( File "F:\New folder\lib\site-packages\gradio\blocks.py", line 1392, in process_api result = await self.call_function( File "F:\New folder\lib\site-packages\gradio\blocks.py", line 1097, in call_function prediction = await anyio.to_thread.run_sync( File "F:\New folder\lib\site-packages\anyio\to_thread.py", line 33, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "F:\New folder\lib\site-packages\anyio_backends_asyncio.py", line 877, in run_sync_in_worker_thread return await future File "F:\New folder\lib\site-packages\anyio_backends_asyncio.py", line 807, in run result = context.run(func, args) File "F:\New folder\lib\site-packages\gradio\utils.py", line 703, in wrapper response = f(args, **kwargs) File "F:\roop\SadTalker\src\gradio_demo.py", line 139, in test return_path = self.animate_from_coeff.generate(data, save_dir, pic_path, crop_info, enhancer='gfpgan' if use_enhancer else None, preprocess=preprocess, img_size=size) File "F:\roop\SadTalker\src\facerender\animate.py", line 246, in generate enhanced_images_gen_with_len = enhancer_list(full_video_path, method=enhancer, bg_upsampler=background_enhancer) File "F:\roop\SadTalker\src\utils\face_enhancer.py", line 28, in enhancer_list return list(gen) File "F:\roop\SadTalker\src\utils\face_enhancer.py", line 49, in enhancer_generator_no_len images = load_video_to_cv2(images) File "F:\roop\SadTalker\src\utils\videoio.py", line 13, in load_video_to_cv2 still_reading, frame = video_stream.read() cv2.error: OpenCV(4.8.0) D:\a\opencv-python\opencv-python\opencv\modules\core\src\alloc.cpp:73: error: (-4:Insufficient memory) Failed to allocate 18874368 bytes in function 'cv::OutOfMemoryError'

kaushal101 commented 8 months ago

I'm getting a very similar error, no clue why this is happening. Did you had any luck with this @daarkwulf ?

Face Enhancer:: 13%|██████████████████████▎ | 49/363 [03:37<23:16, 4.45s/it] Traceback (most recent call last): File "C:\Kaushal\Stable-Diffusion\stable-diffusion-webui/extensions/SadTalker\src\facerender\animate.py", line 244, in generate imageio.mimsave(enhanced_path, enhanced_images_gen_with_len, fps=float(25)) File "C:\Kaushal\Stable-Diffusion\stable-diffusion-webui\venv\lib\site-packages\imageio\v2.py", line 490, in mimwrite raise ValueError("Image data must be a sequence of ndimages.") ValueError: Image data must be a sequence of ndimages.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Kaushal\Stable-Diffusion\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py", line 488, in run_predict output = await app.get_blocks().process_api( File "C:\Kaushal\Stable-Diffusion\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1431, in process_api result = await self.call_function( File "C:\Kaushal\Stable-Diffusion\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1103, in call_function prediction = await anyio.to_thread.run_sync( File "C:\Kaushal\Stable-Diffusion\stable-diffusion-webui\venv\lib\site-packages\anyio\to_thread.py", line 33, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "C:\Kaushal\Stable-Diffusion\stable-diffusion-webui\venv\lib\site-packages\anyio_backends_asyncio.py", line 877, in run_sync_in_worker_thread return await future File "C:\Kaushal\Stable-Diffusion\stable-diffusion-webui\venv\lib\site-packages\anyio_backends_asyncio.py", line 807, in run result = context.run(func, args) File "C:\Kaushal\Stable-Diffusion\stable-diffusion-webui\venv\lib\site-packages\gradio\utils.py", line 707, in wrapper response = f(args, kwargs) File "C:\Kaushal\Stable-Diffusion\stable-diffusion-webui\modules\call_queue.py", line 13, in f res = func(*args, *kwargs) File "C:\Kaushal\Stable-Diffusion\stable-diffusion-webui/extensions/SadTalker\src\gradio_demo.py", line 139, in test return_path = self.animate_from_coeff.generate(data, save_dir, pic_path, crop_info, enhancer='gfpgan' if use_enhancer else None, preprocess=preprocess, img_size=size) File "C:\Kaushal\Stable-Diffusion\stable-diffusion-webui/extensions/SadTalker\src\facerender\animate.py", line 246, in generate enhanced_images_gen_with_len = enhancer_list(full_video_path, method=enhancer, bg_upsampler=background_enhancer) File "C:\Kaushal\Stable-Diffusion\stable-diffusion-webui/extensions/SadTalker\src\utils\face_enhancer.py", line 28, in enhancer_list return list(gen) File "C:\Kaushal\Stable-Diffusion\stable-diffusion-webui/extensions/SadTalker\src\utils\face_enhancer.py", line 116, in enhancer_generator_no_len cropped_faces, restored_faces, r_img = restorer.enhance( File "C:\Kaushal\Stable-Diffusion\stable-diffusion-webui\venv\lib\site-packages\torch\utils_contextlib.py", line 115, in decorate_context return func(args, kwargs) File "C:\Kaushal\Stable-Diffusion\stable-diffusion-webui\venv\lib\site-packages\gfpgan\utils.py", line 145, in enhance restored_img = self.face_helper.paste_faces_to_input_image(upsample_img=bg_img) File "C:\Kaushal\Stable-Diffusion\stable-diffusion-webui\venv\lib\site-packages\facexlib\utils\face_restoration_helper.py", line 355, in paste_faces_to_input_image upsample_img = inv_soft_mask pasted_face + (1 - inv_soft_mask) upsample_img numpy.core._exceptions._ArrayMemoryError: Unable to allocate 765. MiB for an array with shape (7680, 4352, 3) and data type float64