nicofdga / DZ-FaceDetailer

a node for comfyui for restore/edit/enchance faces utilizing face recognition
MIT License
152 stars 14 forks source link

Error occurred when executing DZ_Face_Detailer #1

Closed Vetrov0x closed 11 months ago

Vetrov0x commented 1 year ago

Error occurred when executing DZ_Face_Detailer:

OpenCV(4.7.0) D:\a\opencv-python\opencv-python\opencv\modules\imgproc\src\morph.dispatch.cpp:1010: error: (-215:Assertion failed) !src.empty() in function 'cv::erode'

File "C:\Users\Daedar\Documents\GitHub\AI\webui\extensions\sd-webui-comfyui\ComfyUI\execution.py", line 144, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) File "C:\Users\Daedar\Documents\GitHub\AI\webui\extensions\sd-webui-comfyui\ComfyUI\execution.py", line 74, in get_output_data return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True) File "C:\Users\Daedar\Documents\GitHub\AI\webui\extensions\sd-webui-comfyui\ComfyUI\execution.py", line 67, in map_node_over_list results.append(getattr(obj, func)(**slice_dict(input_data_all, i))) File "C:\Users\Daedar\Documents\GitHub\AI\webui\extensions\sd-webui-comfyui\ComfyUI\custom_nodes\facedetailer\FaceDetailer.py", line 71, in detailer final_mask = dilate_mask(final_mask, dilate_mask_value) File "C:\Users\Daedar\Documents\GitHub\AI\webui\extensions\sd-webui-comfyui\ComfyUI\custom_nodes\facedetailer\FaceDetailer.py", line 184, in dilate_mask eroded_mask = cv2.erode(mask, kernel, iterations=1)

nicofdga commented 11 months ago

are you using comfyui inside auto11111?

aaaaaaaaaaav commented 11 months ago

I'm getting the same error when running it with IPAdapterPlus Face SD 1.5 as the IPAdapter model.

nicofdga commented 11 months ago

Are you using only comfyui or comfyui extension for auto1111?

aaaaaaaaaaav commented 11 months ago

Are you using only comfyui or comfyui extension for auto1111?

I never heard about any ComfyUI extension for A1111? It's just ComfyUI.

aaaaaaaaaaav commented 11 months ago

It turns out the problem has nothing to do with IPAdapter. It just happens in general depending on if the image itself is large or has a face that takes up most of the frame.

aaaaaaaaaaav commented 11 months ago

The other facedetailer has the same issue. But the advantage this one seems to have is it works entirely in latent space which means when it works it tends to work better. If you could fix this problem & give it feature parity with the other facedetailer. This project would be able to easily stand by itself. But judging by how you haven't looked into the problem much beyond asking a unrelated question doesn't give me or anyone else who has this issue much confidence in the project itself.

nicofdga commented 11 months ago

Sorry for the confusion, I thought you were using the extension that allows you to use ComfyUI inside Automatic1111 UI, I am currently researching about IPAdapter and looking for the solution to the problem, thank you very much for informing me about it. in first place the problems seems to be on erode-dilate functions.

aaaaaaaaaaav commented 11 months ago

image image

The issue isn't related to IPAdapter. I disabled it & had the same problem. There's also this problem when trying to convert the mask to an image after disabling the erode-dilate functions.

nicofdga commented 11 months ago

Yes you're right, i tested IPAdater and is working well, but now i'm getting the same error as you in google colab except on my local pc. i'm working to find the error, is weird because the latent shape is correct when I debug the output of the mask.

aaaaaaaaaaav commented 11 months ago

Yes you're right, i tested IPAdater and is working well, but now i'm getting the same error as you in google colab except on my local pc. i'm working to find the error, is weird because the latent shape is correct when I debug the output of the mask.

This is my local system as well. Are you using Comfy on Windows? I'm using it on Linux. I think Google Colab uses a Linux system.

nicofdga commented 11 months ago

I switched to linux and discovered that the problem was in the routes. In windows it worked because of the way it handles routes, but in linux it is different.

I didn't configure the try-exception properly and that's why it threw the error "list index out of range" error which was not accurate because of that, the original error is the one in the image below. Now it works.

image

nicofdga commented 11 months ago

Please remove all folders created in "models" called "DZ-FaceDetailer", update the node and run comfy again.

StudioXV commented 10 months ago

I've the same error described before. I'm using comfyui extension. The solution is the same? txs!