WASasquatch / was-node-suite-comfyui

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

Mask Dilate/Erode Region changes dimensionality of mask #350

Open geoff-m opened 8 months ago

geoff-m commented 8 months ago

The Mask Dilate Region and Mask Erode Region nodes ouput a tensor with different dimensions than their input. This leads to errors when attempting to operate on that output.

I discovered this when I tried feeding the output of a Mask Erode Region to a "Bitwise (Mask & Mask)" node along with another mask that hadn't been eroded. That fails because the "bitwise" node assumes its inputs are of the same shape, but instead they were [512, 512] and [1, 1, 512, 512].

The same issue also applies to other types of nodes, like Mask Threshold Region. They all call unsqueeze twice on their output before returning. Removing the unsqueeze calls has allowed things to work as expected. What's going on here?