Attempt to fix SegFault
* https://github.com/opencv/opencv-python/issues/706
This commit is contained in:
parent
b3b745508b
commit
ab775d9f76
|
|
@ -121,7 +121,8 @@ def _mask_has_multiple_segments(mask: np.ndarray) -> bool:
|
|||
if mask.size == 0:
|
||||
return False
|
||||
mask_uint8 = mask.astype(np.uint8)
|
||||
number_of_labels, _ = cv2.connectedComponents(mask_uint8, connectivity=4)
|
||||
labels = np.zeros_like(mask_uint8, dtype=np.int32)
|
||||
number_of_labels, _ = cv2.connectedComponents(mask_uint8, labels, connectivity=4)
|
||||
return number_of_labels > 2
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -500,7 +500,7 @@ def test_build_coco_class_index_mapping(
|
|||
# area=5 * 5,
|
||||
# segmentation=[[0, 0, 2, 0, 2, 2, 4, 2, 4, 4, 0, 4]])],
|
||||
# DoesNotRaise(),
|
||||
# ), # segmentation mask in single component,no holes in mask, expects polygon mask
|
||||
# ), # seg mask in single component,no holes in mask, expects polygon
|
||||
(
|
||||
Detections(
|
||||
xyxy=np.array([[0, 0, 5, 5]], dtype=np.float32),
|
||||
|
|
@ -564,7 +564,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(
|
||||
|
|
|
|||
Loading…
Reference in New Issue