Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sam2/utils/amg.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ def remove_small_regions(
n_labels, regions, stats, _ = cv2.connectedComponentsWithStats(working_mask, 8)
sizes = stats[:, -1][1:] # Row 0 is background label
small_regions = [i + 1 for i, s in enumerate(sizes) if s < area_thresh]
if len(small_regions) == 0:
if len(small_regions) <= 1:
return mask, False
fill_labels = [0] + small_regions
if not correct_holes:
Expand Down