diff --git a/py/crop_by_mask.py b/py/crop_by_mask.py index 4fa89fa..b1d01cb 100644 --- a/py/crop_by_mask.py +++ b/py/crop_by_mask.py @@ -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 diff --git a/py/crop_by_mask_v2.py b/py/crop_by_mask_v2.py index d56a697..707a441 100644 --- a/py/crop_by_mask_v2.py +++ b/py/crop_by_mask_v2.py @@ -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