Update sam_module.py
Browse files- sam_module.py +2 -2
sam_module.py
CHANGED
|
@@ -388,9 +388,9 @@ def create_sam_mask(self, image, bbox_coords, mode):
|
|
| 388 |
continue
|
| 389 |
|
| 390 |
# Heuristik-Berechnung
|
| 391 |
-
mask_area_pixels = np.sum(mask_binary)
|
| 392 |
|
| 393 |
-
# BBox
|
| 394 |
bbox_mask = np.zeros((image.height, image.width), dtype=np.uint8)
|
| 395 |
bbox_mask[y1:y2, x1:x2] = 1
|
| 396 |
overlap = np.sum(mask_binary & bbox_mask)
|
|
|
|
| 388 |
continue
|
| 389 |
|
| 390 |
# Heuristik-Berechnung
|
| 391 |
+
mask_area_pixels = np.sum(mask_binary) # zählt alle weißen Pixel in der Binärmaske
|
| 392 |
|
| 393 |
+
# Berechnet wie gut die SAM-Maske mit der ursprünglichen BBox überlappt
|
| 394 |
bbox_mask = np.zeros((image.height, image.width), dtype=np.uint8)
|
| 395 |
bbox_mask[y1:y2, x1:x2] = 1
|
| 396 |
overlap = np.sum(mask_binary & bbox_mask)
|