[Bug]: get_crop_region_v2
error, when Only masked padding, pixels
is set to 0
#15593
Closed
4 of 6 tasks
Labels
bug-report
Report of a bug, yet to be confirmed
Checklist
What happened?
When img2img inpainting, if you set
inpaint area
=Only Masked
,Only masked padding, pixels
=0
, you can see below TypeErrorSteps to reproduce the problem
inpaint area
=Only Masked
,Only masked padding, pixels
=0
,What should have happened?
No TypeError...
What browsers do you use to access the UI ?
Google Chrome
Sysinfo
sysinfo-2024-04-22-13-42.json
Console logs
Additional information
Would this interpretation from pylance be helpful?
Currently, the return type of the get_crop_region_v2 function is either
tuple[int, int, int, int]
ortuple[int, int, int, tuple[...]]
This is because the ternary operator evaluates before the comma.
In the return value above, the rightmost ternary operator is evaluated first because the return value is not enclosed in parentheses.
so
if pad
(if pad != 0)the return value will be
max(x1 - pad, 0), max(y1 - pad, 0), min(x2 + pad, mask.size[0]), min(y2 + pad, mask.size[1])
if pad else boxelse
not pad
max(x1 - pad, 0), max(y1 - pad, 0), min(x2 + pad, mask.size[0])
, min(y2 + pad, mask.size[1]) if pad elsebox
->
max(x1 - pad, 0), max(y1 - pad, 0), min(x2 + pad, mask.size[0]), box
Therefore, the subsequent process will raise TypeError because y2 is a tuple.
The text was updated successfully, but these errors were encountered: