You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use this in ComfyUI , it raise error when I input image(weigh=724, height=1448):
Argument #4: padding size should be less than the corresponding input dimension, but got: padding (0, 724) at dimension 3 of input [1,3,1448,724]
File "/mnt/sda/comfyUI/custom nodes/comfyui-inpaint-nodes/util.py", line 37, in resize_square
image = F.pad(image,(0, pad_w, 0, pad_h), mode="reflect')
I modify the 'resize_square' code and it run normally:
def resize_square(image: Tensor, mask: Tensor, size: int):
_, _, h, w = image.shape
pad_w, pad_h, prev_size = 0, 0, w
if w == size and h == size:
return image, mask, (pad_w, pad_h, prev_size)
if w < h:
pad_w = h - w
prev_size = h
elif h < w:
pad_h = w - h
prev_size = w
print('###################################')
pad_w2, pad_h2 = pad_w, pad_h
while pad_w2 > 0 or pad_h2 > 0:
_pad_w = w-1 if pad_w2>=w else pad_w2
pad_w2 -= _pad_w
_pad_h = h-1 if pad_h2>=h else pad_h2
pad_h2 -= _pad_h
image = F.pad(image, (0, _pad_w, 0, _pad_h), mode="reflect")
mask = F.pad(mask, (0, _pad_w, 0, _pad_h), mode="reflect")
#image = F.pad(image, (0, pad_w, 0, pad_h), mode="reflect")
#mask = F.pad(mask, (0, pad_w, 0, pad_h), mode="reflect")
print('###################################')
if image.shape[-1] != size:
image = F.interpolate(image, size=size, mode="nearest-exact")
mask = F.interpolate(mask, size=size, mode="nearest-exact")
return image, mask, (pad_w, pad_h, prev_size)
The text was updated successfully, but these errors were encountered:
I use this in ComfyUI , it raise error when I input image(weigh=724, height=1448):
I modify the 'resize_square' code and it run normally:
The text was updated successfully, but these errors were encountered: