diff --git a/inference/core/workflows/core_steps/transformations/bounding_rect/v1.py b/inference/core/workflows/core_steps/transformations/bounding_rect/v1.py index a75b5d700..8c0b56b61 100644 --- a/inference/core/workflows/core_steps/transformations/bounding_rect/v1.py +++ b/inference/core/workflows/core_steps/transformations/bounding_rect/v1.py @@ -111,6 +111,18 @@ def run( det.mask[0] ) + det.mask = np.array( + [ + sv.polygon_to_mask( + polygon=np.around(rect).astype(np.int32), + resolution_wh=(det.mask[0].shape[1], det.mask[0].shape[0]), + ).astype(bool) + ] + ) + det.xyxy = np.array( + [sv.polygon_to_xyxy(polygon=np.around(rect).astype(np.int32))] + ) + det[BOUNDING_RECT_RECT_KEY_IN_SV_DETECTIONS] = np.array( [rect], dtype=np.float16 )