Error "Failed to modify image: {str(e)}"

#13
by mmacmahon - opened

Hi, I'm getting this error (originally posted in the discussion about the alpha channel bug--sorry for my late followup on that, was tied up with work last week!). I've cleared and reinstalled FacePoke (just to check I hadn't been incorrectly pulling the bug fixes related to the alpha channel fix), and think this error may be something else. I'm able to pull up the UI, but this error pops up as soon as the image is imported. The face markers are correctly identified and displayed, but nothing happens when I click drag because of this error:

2024-10-23 20:46:25,849 - aiohttp.access - INFO - 127.0.0.1 [23/Oct/2024:19:46:25 -0800] "GET / HTTP/1.1" 200 488 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36"
2024-10-23 20:46:25,857 - aiohttp.access - INFO - 127.0.0.1 [23/Oct/2024:19:46:25 -0800] "GET /index.js HTTP/1.1" 200 1300223 "http://localhost:8080/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36"
2024-10-23 20:46:26,104 - aiohttp.access - INFO - 127.0.0.1 [23/Oct/2024:19:46:26 -0800] "GET /hf-logo.svg HTTP/1.1" 200 4792 "http://localhost:8080/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36"
/home//Documents/projects/FacePoke/liveportrait/utils/dependencies/insightface/utils/transform.py:68: FutureWarning: rcond parameter will change to the default of machine precision times max(M, N) where M and N are the input matrix dimensions.
To use the future default and silence this warning we advise to pass rcond=None, to keep using the old, explicitly pass rcond=-1.
P = np.linalg.lstsq(X_homo, Y)[0].T # Affine matrix. 3 x 4
2024-10-23 20:46:41,731 - main - ERROR - Error in engine: Failed to modify image: OpenCV(4.8.1) /io/opencv/modules/imgproc/src/imgwarp.cpp:2729: error: (-215:Assertion failed) src.cols > 0 && src.rows > 0 in function 'warpAffine'

2024-10-23 20:46:41,731 - main - ERROR - Full traceback:
Traceback (most recent call last):
File "/home//Documents/projects/FacePoke/engine.py", line 209, in transform_image
mask_ori = await asyncio.to_thread(prepare_paste_back,
File "/usr/lib/python3.10/asyncio/threads.py", line 25, in to_thread
return await loop.run_in_executor(None, func_call)
File "/usr/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/home//Documents/projects/FacePoke/liveportrait/utils/crop.py", line 402, in prepare_paste_back
mask_ori = _transform_img(mask_crop, crop_M_c2o, dsize)
File "/home/mmacmahon/Documents/projects/FacePoke/liveportrait/utils/crop.py", line 33, in _transform_img
return cv2.warpAffine(img, M[:2, :], dsize=_dsize, flags=flags)
cv2.error: OpenCV(4.8.1) /io/opencv/modules/imgproc/src/imgwarp.cpp:2729: error: (-215:Assertion failed) src.cols > 0 && src.rows > 0 in function 'warpAffine'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home//Documents/projects/FacePoke/app.py", line 82, in websocket_handler
webp_bytes = await engine.transform_image(data.get('uuid'), data.get('params'))
File "/home//Documents/projects/FacePoke/engine.py", line 228, in transform_image
raise ValueError(f"Failed to modify image: {str(e)}")
ValueError: Failed to modify image: OpenCV(4.8.1) /io/opencv/modules/imgproc/src/imgwarp.cpp:2729: error: (-215:Assertion failed) src.cols > 0 && src.rows > 0 in function 'warpAffine'

This is the image I'm using:
Female01_output_small.png

mmacmahon changed discussion status to closed

Sign up or log in to comment