Skip to content

Commit 1e7c490

Browse files
committed
Fix Point Prompt Generations - for Background Pixels
1 parent 4ee1876 commit 1e7c490

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

micro_sam/prompt_generators.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,10 @@ def __call__(self, gt, gt_id, center_coordinates, bbox_coordinates):
5252
dilated_object = binary_dilation(object_mask, iterations=self.dilation_strength)
5353
background_mask = np.zeros(gt.shape)
5454
background_mask[bbox_coordinates[0]:bbox_coordinates[2], bbox_coordinates[1]:bbox_coordinates[3]] = 1
55-
background_mask = abs(background_mask - dilated_object)
5655
background_mask = binary_dilation(background_mask, iterations=self.dilation_strength)
56+
background_mask = abs(
57+
background_mask.astype(np.float32) - dilated_object.astype(np.float32)
58+
) # casting booleans to do subtraction
5759

5860
n_negative_remaining = self.n_negative_points
5961
if n_negative_remaining > 0:

0 commit comments

Comments
 (0)