Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Resize issue #183

Open
TanvirHafiz opened this issue Oct 25, 2024 · 6 comments
Open

Resize issue #183

TanvirHafiz opened this issue Oct 25, 2024 · 6 comments

Comments

@TanvirHafiz
Copy link

I got this error:

Traceback (most recent call last):
File "F:\EchoMimic\venv\lib\site-packages\gradio\queueing.py", line 624, in process_events
response = await route_utils.call_process_api(
File "F:\EchoMimic\venv\lib\site-packages\gradio\route_utils.py", line 323, in call_process_api
output = await app.get_blocks().process_api(
File "F:\EchoMimic\venv\lib\site-packages\gradio\blocks.py", line 2018, in process_api
result = await self.call_function(
File "F:\EchoMimic\venv\lib\site-packages\gradio\blocks.py", line 1567, in call_function
prediction = await anyio.to_thread.run_sync( # type: ignore
File "F:\EchoMimic\venv\lib\site-packages\anyio\to_thread.py", line 56, in run_sync
return await get_async_backend().run_sync_in_worker_thread(
File "F:\EchoMimic\venv\lib\site-packages\anyio_backends_asyncio.py", line 2441, in run_sync_in_worker_thread
return await future
File "F:\EchoMimic\venv\lib\site-packages\anyio_backends_asyncio.py", line 943, in run
result = context.run(func, *args)
File "F:\EchoMimic\venv\lib\site-packages\gradio\utils.py", line 846, in wrapper
response = f(*args, **kwargs)
File "F:\EchoMimic\webgui.py", line 233, in generate_video
final_output_path = process_video(
File "F:\EchoMimic\webgui.py", line 169, in process_video
face_img = cv2.resize(face_img, (width, height))
cv2.error: OpenCV(4.10.0) 👎 error: (-5:Bad argument) in function 'resize'

Overload resolution failed:

  • src is not a numerical tuple
  • Expected Ptrcv::UMat for argument 'src'

Seems to be an issue with resizing. but it shouldnt be. any help suggestion?

@nitinmukesh
Copy link

Try with command line first.

@TanvirHafiz
Copy link
Author

Try with command line first.

i dont know how to do that and i dont want to run the interface like that either. the gradio is working fine. just this error relating to resizing

@TanvirHafiz
Copy link
Author

okay so it seems that echomimic only supports square aspect ratios, so images need to be cut at 512 x 512 or some other square resolution. which is strange because it seems to have a image size slider. i wonder what that is for.

@nitinmukesh
Copy link

Yes 512 x 512. just ignore the slider.

@csimlinger
Copy link

I get the same error, also with square images. no matter if I use my own images or the official test images.
In console it works great. Any idea how to solve the issue?

@csimlinger
Copy link

I found the solution.

Open webgui.py and change the part from line 162 to this:

# Crop and pad face_img
face_img = crop_and_pad(face_img, crop_rect)
if isinstance(face_img, tuple):
    face_img = face_img[0]  # Keep only the image part if crop_and_pad returns a tuple

# Crop and pad face_mask
face_mask = crop_and_pad(face_mask, crop_rect)
if isinstance(face_mask, tuple):
    face_mask = face_mask[0]  # Keep only the mask part if crop_and_pad returns a tuple

The reason it didn’t work was that crop_and_pad returned a tuple instead of a numpy.ndarray, causing an AttributeError when accessing .shape. Selecting only the first element resolved the issue.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants