CropByMask and V2 nodes is forced to size in multiples of 8

This commit is contained in:
chflame
2024-03-21 09:57:09 +08:00
parent 05863b333a
commit e7bf53c899
2 changed files with 7 additions and 0 deletions
+3
View File
@@ -65,6 +65,9 @@ class CropByMask:
(x, y, width, height) = max_inscribed_rect(bluredmask)
else:
(x, y, width, height) = mask_area(_mask)
width = num_round_to_multiple(width, 8)
height = num_round_to_multiple(height, 8)
log(f"{NODE_NAME}: Box detected. x={x},y={y},width={width},height={height}")
canvas_width, canvas_height = tensor2pil(torch.unsqueeze(image[0], 0)).convert('RGB').size
x1 = x - left_reserve if x - left_reserve > 0 else 0
+4
View File
@@ -69,6 +69,10 @@ class CropByMaskV2:
(x, y, width, height) = max_inscribed_rect(bluredmask)
else:
(x, y, width, height) = mask_area(_mask)
width = num_round_to_multiple(width, 8)
height = num_round_to_multiple(height, 8)
log(f"{NODE_NAME}: Box detected. x={x},y={y},width={width},height={height}")
canvas_width, canvas_height = tensor2pil(torch.unsqueeze(image[0], 0)).convert('RGB').size
x1 = x - left_reserve if x - left_reserve > 0 else 0