merge seg fault fix

This commit is contained in:
magda skoczen committed 2024-05-17 11:11:40 +02:00
commit aad5e2a212
2 files changed
+5 -4

No files matched your search

+3 -2
View File
@@ -118,8 +118,9 @@ def _mask_has_holes(mask: np.ndarray) -> bool:
def _mask_has_multiple_segments(mask: np.ndarray) -> bool:
mask_uint8 = mask.astype(np.uint8)
number_of_labels, _ = cv2.connectedComponents(mask_uint8, connectivity=4)
mask_uint8 = mask.astype(np.uint8)
labels = np.zeros_like(mask_uint8, dtype=np.int32)
number_of_labels, _ = cv2.connectedComponents(mask_uint8, labels, connectivity=4)
return number_of_labels > 2
+2 -2
View File
@@ -476,7 +476,7 @@ def test_build_coco_class_index_mapping(
],
DoesNotRaise(),
), # no segmentation mask
(
(
Detections(
xyxy=np.array([[0, 0, 4, 5]], dtype=np.float32),
class_id=np.array([0], dtype=int),
@@ -565,7 +565,7 @@ def test_build_coco_class_index_mapping(
)
],
DoesNotRaise(),
), # segmentation mask in single component, with holes in mask, expects RLE mask
), # seg mask in single component, with holes in mask, expects RLE mask
],
)
def test_detections_to_coco_annotations(