TheRealALIUSERNAME commited on
Commit
e4b3765
·
1 Parent(s): 4a1efb8
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -135,10 +135,13 @@ def visualize_sam_masks(image_array):
135
  for i, (mask, score) in enumerate(zip(masks, scores)):
136
  x_offset = w * (i + 1)
137
 
 
 
 
138
  # Create overlay
139
  overlay = image_array.copy()
140
  color_mask = np.zeros_like(image_array)
141
- color_mask[mask] = colors[i]
142
  overlay = cv2.addWeighted(overlay, 0.6, color_mask, 0.4, 0)
143
 
144
  # Draw bounding box
 
135
  for i, (mask, score) in enumerate(zip(masks, scores)):
136
  x_offset = w * (i + 1)
137
 
138
+ # Convert mask to boolean if needed
139
+ mask_bool = mask.astype(bool)
140
+
141
  # Create overlay
142
  overlay = image_array.copy()
143
  color_mask = np.zeros_like(image_array)
144
+ color_mask[mask_bool] = colors[i]
145
  overlay = cv2.addWeighted(overlay, 0.6, color_mask, 0.4, 0)
146
 
147
  # Draw bounding box