Skip to content

Commit 6330b72

Browse files
Fix check in automatic instance segmentation
1 parent e623e58 commit 6330b72

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

micro_sam/automatic_segmentation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def automatic_instance_segmentation(
106106
ndim = image_data.ndim if ndim is None else ndim
107107

108108
if ndim == 2:
109-
if image_data.ndim != 2 or image_data.shape[-1] != 3:
109+
if (image_data.ndim != 2) and (image_data.ndim != 3 and image_data.shape[-1] != 3):
110110
raise ValueError(f"The inputs does not match the shape expectation of 2d inputs: {image_data.shape}")
111111

112112
# Precompute the image embeddings.
@@ -135,7 +135,7 @@ def automatic_instance_segmentation(
135135
else:
136136
instances = mask_data_to_segmentation(masks, with_background=True, min_object_size=0)
137137
else:
138-
if image_data.ndim != 3 or image_data.shape[-1] != 3:
138+
if (image_data.ndim != 3) and (image_data.ndim != 4 and image_data.shape[-1] != 3):
139139
raise ValueError(f"The inputs does not match the shape expectation of 3d inputs: {image_data.shape}")
140140

141141
instances = automatic_3d_segmentation(

0 commit comments

Comments
 (0)