WASasquatch / was-node-suite-comfyui

An extensive node suite for ComfyUI with over 210 new nodes
MIT License
1.15k stars 170 forks source link

ValueError: Too many dimensions: 3 > 2. #229

Open hben35096 opened 12 months ago

hben35096 commented 12 months ago

I updated ComfyUI to: 0e763e880f5e838e7a1e3914444cae6790c48627, Impact Pack updated to: b4c0ddf33e5c8634fce180449af54af4daaa3983, was-node-suite-comfyui: 6a3870ddfc4a0f5a32045f3e1fa45e10c60f4ea2, an error is reported at another node:

!!! Exception during processing !!! Traceback (most recent call last): File "/mnt/workspace/ComfyUI/execution.py", line 152, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) File "/mnt/workspace/ComfyUI/execution.py", line 82, in get_output_data return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True) File "/mnt/workspace/ComfyUI/execution.py", line 75, in map_node_over_list results.append(getattr(obj, func)(*slice_dict(input_data_all, i))) File "/mnt/workspace/ComfyUI/custom_nodes/was-node-suite-comfyui/WAS_Node_Suite.py", line 11349, in bounded_image_blend_with_mask target_mask_pil = Image.fromarray((target_mask.cpu().numpy() 255).astype(np.uint8), mode='L') File "/opt/conda/lib/python3.10/site-packages/PIL/Image.py", line 3103, in fromarray raise ValueError(msg) ValueError: Too many dimensions: 3 > 2.

image

So, I fall back to ComfyUI:77c124c5a17534e347bdebbc1ace807d61416147; Impact Pack remains up to date:b4c0ddf33e5c8634fce180449af54af4daaa3983; was-node-suite-comfyui: 6a3870ddfc4a0f5a32045f3e1fa45e10c60f4ea2. Everything is normal.

Details: https://github.com/comfyanonymous/ComfyUI/issues/1665

I guess this should have something to do with the WAS node

WASasquatch commented 12 months ago

The masks are batched now, so that's likely the issue. The image bound nodes were a PR done a long time ago before that so it's likely not expecting a batched mask..

hben35096 commented 11 months ago

image was-node-suite-comfyui:ac6ee06c6dc5752f55c3b96d1fd7c7ab7a58f498 ComfyUI:5e885bd9c822a3cc7d50d75a40958265f497cd03 Is this output correct?

hben35096 commented 11 months ago

was-node-suite-comfyui:6a3870ddfc4a0f5a32045f3e1fa45e10c60f4ea2 ComfyUI:5e885bd9c822a3cc7d50d75a40958265f497cd03 image

hben35096 commented 11 months ago

And this: was-node-suite-comfyui:6a3870ddfc4a0f5a32045f3e1fa45e10c60f4ea2 ComfyUI:5e885bd9c822a3cc7d50d75a40958265f497cd03 image

Error occurred when executing Bounded Image Blend with Mask:

Too many dimensions: 3 > 2.

File "/mnt/workspace/ComfyUI/execution.py", line 152, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) File "/mnt/workspace/ComfyUI/execution.py", line 82, in get_output_data return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True) File "/mnt/workspace/ComfyUI/execution.py", line 75, in map_node_over_list results.append(getattr(obj, func)(*slice_dict(input_data_all, i))) File "/mnt/workspace/ComfyUI/custom_nodes/was-node-suite-comfyui/WAS_Node_Suite.py", line 11349, in bounded_image_blend_with_mask target_mask_pil = Image.fromarray((target_mask.cpu().numpy() 255).astype(np.uint8), mode='L') File "/opt/conda/lib/python3.10/site-packages/PIL/Image.py", line 3103, in fromarray raise ValueError(msg)

WASasquatch commented 11 months ago

Honestly not sure what's going on here. This wasn't my code, and a PR. It's a mess to look at and read through. I've never even used these nodes. I have my own padding image nodes. Image Padding and Image Crop Location

LoneOutpost commented 11 months ago

The problem with the 3>2 is specifically a problem converting the image mask to grayscale. The problem with the line is addressed by fixing another problem that I opened a ticket for with the solution, but I'm afraid that's only the tip of the iceberg. The bigger issue is there are a bunch of problems with these bounded nodes having a mishmash of support for batches. At times it will check for a batch, but not check to see if that is a batch greater than one but assume it isn't. Other places it not check to see if what the dimensions of the images are, but proceed to wrap batched images in another dimension which then will error later on down the line. It would be better if it didn't try to support batches and just squeeze everything down as it comes in (as it partially does in other nodes). They are a mess. I've been working on these locally over the past couple of days, just so I can try to get them working for an old complex workflow. I would be more than willing to share my fixes with you when I'm done, otherwise, I'm probably just going to build my own custom nodes for my personal use and replace these within this workflow. I really just approached this as a learning exercise, but I'd thought I'd share my findings.

WASasquatch commented 11 months ago

The problem with the 3>2 is specifically a problem converting the image mask to grayscale. The problem with the line is addressed by fixing another problem that I opened a ticket for with the solution, but I'm afraid that's only the tip of the iceberg. The bigger issue is there are a bunch of problems with these bounded nodes having a mishmash of support for batches. At times it will check for a batch, but not check to see if that is a batch greater than one but assume it isn't. Other places it not check to see if what the dimensions of the images are, but proceed to wrap batched images in another dimension which then will error later on down the line. It would be better if it didn't try to support batches and just squeeze everything down as it comes in (as it partially does in other nodes). They are a mess. I've been working on these locally over the past couple of days, just so I can try to get them working for an old complex workflow. I would be more than willing to share my fixes with you when I'm done, otherwise, I'm probably just going to build my own custom nodes for my personal use and replace these within this workflow. I really just approached this as a learning exercise, but I'd thought I'd share my findings.

That would be great. I haven't had as much time to work on WAS-NS with work, and these nodes are just wee bit weird. Also I am just terrible with math, so that sorta work is usually trial and error for me. I have dyscslculia and dyslexia. Great conditions for someone that loves programming lol