Spaces:
Runtime error
Runtime error
Update mask_adapter/sam_maskadapter.py
Browse files
mask_adapter/sam_maskadapter.py
CHANGED
|
@@ -387,8 +387,8 @@ class SAMPointVisualizationDemo(object):
|
|
| 387 |
label = f"{self.class_names[max_score_idx.item()]}: {max_scores.item():.2f}"
|
| 388 |
|
| 389 |
# Dynamically place the label near the clicked point
|
| 390 |
-
text_x = min(width - 200, points[0][0] +
|
| 391 |
-
text_y = min(height - 30, points[0][1] +
|
| 392 |
|
| 393 |
# Put text near the point
|
| 394 |
cv2.putText(overlay, label, (text_x, text_y), cv2.FONT_HERSHEY_SIMPLEX, 1, (255, 255, 255), 2)
|
|
|
|
| 387 |
label = f"{self.class_names[max_score_idx.item()]}: {max_scores.item():.2f}"
|
| 388 |
|
| 389 |
# Dynamically place the label near the clicked point
|
| 390 |
+
text_x = min(width - 200, points[0][0] + 5) # Add some offset from the point
|
| 391 |
+
text_y = min(height - 30, points[0][1] + 10) # Ensure the text does not go out of bounds
|
| 392 |
|
| 393 |
# Put text near the point
|
| 394 |
cv2.putText(overlay, label, (text_x, text_y), cv2.FONT_HERSHEY_SIMPLEX, 1, (255, 255, 255), 2)
|