Fannovel16 / comfyui_controlnet_aux

ComfyUI's ControlNet Auxiliary Preprocessors
Apache License 2.0
2.27k stars 209 forks source link

Error on controlnet_aux\dwpose #46

Open p0mad opened 1 year ago

p0mad commented 1 year ago

Hi

I get error after generating about 90-130 images using API! I have enough Memory,CPU and vRAM!

Speed: 15.6ms preprocess, 15.6ms inference, 0.0ms postprocess per image at shape (1, 3, 640, 640) !!! Exception during processing !!! Traceback (most recent call last): File "D:\sl\win\Control\execution.py", line 151, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) File "D:\sl\win\Control\execution.py", line 81, in get_output_data return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True) File "D:\sl\win\Control\execution.py", line 74, in map_node_over_list results.append(getattr(obj, func)(slice_dict(input_data_all, i))) File "D:\sl\win\Control\custom_nodes\comfyui_controlnet_aux\node_wrappers\dwpose.py", line 28, in estimate_pose out = common_annotator_call(model, image, include_hand=detect_hand, include_face=detect_face, include_body=detect_body) File "D:\sl\win\Control\custom_nodes\comfyui_controlnet_aux\utils.py", line 28, in common_annotator_call np_result = model(np_image, output_type="np", kwargs) File "D:\sl\win\Control\custom_nodes\comfyui_controlnet_aux\src\controlnet_aux\dwpose__init.py", line 204, in call poses = self.detect_poses(input_image) File "D:\sl\win\Control\custom_nodes\comfyui_controlnet_aux\src\controlnet_aux\dwpose\init.py", line 180, in detect_poses keypoints_info = self.dw_pose_estimation(oriImg.copy()) File "D:\sl\win\Control\custom_nodes\comfyui_controlnet_aux\src\controlnet_aux\dwpose\wholebody.py", line 33, in call__ keypoints, scores = inference_pose(self.session_pose, det_result, oriImg) File "D:\sl\win\Control\custom_nodes\comfyui_controlnet_aux\src\controlnet_aux\dwpose\cv_ox_pose.py", line 352, in inference_pose outputs = inference(session, resized_img) File "D:\sl\win\Control\custom_nodes\comfyui_controlnet_aux\src\controlnet_aux\dwpose\cv_ox_pose.py", line 70, in inference outputs = sess.forward(outNames) cv2.error: bad allocation

Thanks Best regards

Fannovel16 commented 1 year ago

What CPU and GPU do you use?

p0mad commented 1 year ago

2080ti 2x 8Gb vRAM

Fannovel16 commented 1 year ago

Have the bug appeared multiple times?

Fannovel16 commented 1 year ago

DWPose use RAM instead of VRAM as pre-compiled cv2 only supports the CPU. How much RAM do your machine have and do you remember how much free RAM left?

p0mad commented 1 year ago

Have the bug appeared multiple times?

Sorry for late reply. its the third time!

How much RAM do your machine have

It has 96GB RAM

the left was about 50

Fannovel16 commented 1 year ago

@p0mad I think this bug is related to the underlying C++ in cv2. Just a guess but the cause may be conflicts between opencv packages. Try removing any package relating to opencv then install opencv-python>=4.8.0

Fannovel16 commented 1 year ago

Alternatively, I will try to convert DWPose's onnx model to PyTorch.

p0mad commented 1 year ago

Alternatively, I will try to convert DWPose's onnx model to PyTorch.

Thats really the best option ( GPU mode)

p0mad commented 1 year ago

Hi again, Even if the Dw does not through an error and remove it but the problem persists ... i guess it loads this checkpoint as much as i create images! i always see such thing on my terminal while generating images but no other nodes does that!

In my opinion the problem was leaking memory using this one: I would be glad to know your ...

load checkpoint from local path: D:\sl\win\Control\custom_nodes\comfyui_controlnet_aux\ckpts\models--lllyasviel--Annotators\snapshots\982e7edaec38759d914a963c48c4726685de7d96\upernet_global_small.pth