Skip to content

Commit 7d1d648

Browse files
authored
Fix empty mask overlay handling when no objects are detected. (#350)
1 parent 8888ba6 commit 7d1d648

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

samgeo/text_sam.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,10 @@ def predict(
342342

343343
if boxes.nelement() == 0: # No "object" instances found
344344
print("No objects found in the image.")
345-
return
345+
mask_overlay = np.zeros_like(
346+
image_np[..., 0], dtype=dtype
347+
) # Create an empty mask overlay
348+
346349
else:
347350
# Create an empty image to store the mask overlays
348351
mask_overlay = np.zeros_like(

0 commit comments

Comments
 (0)