Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor update to prompt-based segmentation #825

Merged
merged 2 commits into from
Jan 5, 2025
Merged
Changes from 1 commit
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
4 changes: 2 additions & 2 deletions micro_sam/prompt_based_segmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ def _to_tile(prompts, shape, tile_shape, halo):
raise ValueError("If points are passed you also need to pass labels.")
point_coords, point_labels = points, labels

elif use_points:
elif use_points and len(np.unique(mask)) > 1:
anwai98 marked this conversation as resolved.
Show resolved Hide resolved
point_coords, point_labels = _compute_points_from_mask(
mask, original_size=original_size, box_extension=box_extension,
use_single_point=use_single_point,
Expand All @@ -395,7 +395,7 @@ def _to_tile(prompts, shape, tile_shape, halo):
if box is None:
box = _compute_box_from_mask(
mask, original_size=original_size, box_extension=box_extension
) if use_box else None
) if use_box and len(np.unique(mask)) > 1 else None
anwai98 marked this conversation as resolved.
Show resolved Hide resolved
else:
box = _process_box(box, mask.shape, original_size=original_size, box_extension=box_extension)

Expand Down
Loading