Skip to content

Commit

Permalink
Merge pull request #20 from roboflow/bug/handle_empty_mask_edge_case_…
Browse files Browse the repository at this point in the history
…on_masks_to_marks

Handle empty mask edge case in postprocessing.
  • Loading branch information
SkalskiP committed Dec 4, 2023
2 parents 85b08ab + 2817b53 commit d1dfcd4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions maestro/postprocessing/mask.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@ def masks_to_marks(masks: np.ndarray) -> sv.Detections:
sv.Detections: An object containing the masks and their bounding box
coordinates.
"""
if len(masks) == 0:
marks = sv.Detections.empty()
marks.mask = np.empty((0, 0, 0), dtype=bool)
return marks
return sv.Detections(
mask=masks,
xyxy=sv.mask_to_xyxy(masks=masks)
Expand Down

0 comments on commit d1dfcd4

Please sign in to comment.