Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

function get_landmark_and_bbox leads to the OpenCV error: (-215:Assertion failed) !ssize.empty() in function 'resize' #251

Open
XieJJ99 opened this issue Jan 3, 2025 · 0 comments

Comments

@XieJJ99
Copy link

XieJJ99 commented Jan 3, 2025

We're using video as the input and then encounter the following error.

Traceback (most recent call last):
File "/root/miniconda3/envs/musetalk/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/root/miniconda3/envs/musetalk/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/root/musetalk/scripts/inference.py", line 162, in
main(args)
File "/root/miniconda3/envs/musetalk/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context
return func(*args, **kwargs)
File "/root/musetalk/scripts/inference.py", line 91, in main
crop_frame = cv2.resize(crop_frame,(256,256),interpolation = cv2.INTER_LANCZOS4)
cv2.error: OpenCV(4.10.0) /io/opencv/modules/imgproc/src/resize.cpp:4152: error: (-215:Assertion failed) !ssize.empty() in function 'resize'

We added some debug information, and then found it relates to the get_landmark_and_bbox function, sometimes the y1 position in the coord_list is negative, here's the code in inference.py:

            coord_list, frame_list = get_landmark_and_bbox(input_img_list, bbox_shift)
#......
            if crop_frame.size == 0:
                print(f"Frame empty: {x1},{y1}->{x2},{y2}")
                continue

sample output in x1,y1->x2,y2 format:
Frame empty: 612,-1->848,343
Frame empty: 612,-1->848,343
Frame empty: 612,-10->851,340
Frame empty: 612,-8->848,332
Frame empty: 615,-18->848,326
Frame empty: 615,-15->848,323
Frame empty: 617,-21->848,323
Frame empty: 617,-15->845,323
Frame empty: 620,-8->845,326
Frame empty: 617,-2->845,332
Frame empty: 620,-2->848,332
Frame empty: 603,-1->828,309
Frame empty: 603,-1->828,309
Frame empty: 603,-1->828,315
Frame empty: 603,-1->828,315
Frame empty: 606,-1->828,315
Frame empty: 612,-5->834,307
Frame empty: 615,-2->834,304
Frame empty: 615,-5->837,301
Frame empty: 617,-6->837,298

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

No branches or pull requests

1 participant