Astridkraft commited on
Commit
a786d89
·
verified ·
1 Parent(s): e95e8fd

Update sam_module.py

Browse files
Files changed (1) hide show
  1. sam_module.py +4 -4
sam_module.py CHANGED
@@ -747,8 +747,8 @@ def create_sam_mask(self, image, bbox_coords, mode):
747
  #==============
748
 
749
  # Masken speichern in den Arrays
750
- all_masks_crop = []
751
- all_masks_original = []
752
 
753
  for i in range(num_masks):
754
  single_mask = outputs.pred_masks[:, :, i, :, :]
@@ -852,7 +852,7 @@ def create_sam_mask(self, image, bbox_coords, mode):
852
  # Exzentrizität (wie elliptisch) - Köpfe sind tendenziell elliptisch
853
  eccentricity = largest_region.eccentricity if hasattr(largest_region, 'eccentricity') else 0.5
854
 
855
- # Perfekt ronde Formen (Kreis) sind 0, Linie wäre 1
856
  # Köpfe haben typischerweise 0.5-0.8
857
  if 0.4 <= eccentricity <= 0.9:
858
  eccentricity_score = 1.0 - abs(eccentricity - 0.65) * 2
@@ -1073,7 +1073,7 @@ def create_sam_mask(self, image, bbox_coords, mode):
1073
 
1074
  print("#" * 80)
1075
 
1076
- return mask, raw_mask #in app.py wird mask immer auf t12 skaliert
1077
 
1078
  # ============================================================
1079
  # UNBEKANNTER MODUS
 
747
  #==============
748
 
749
  # Masken speichern in den Arrays
750
+ all_masks_crop = [] #Weiterverarbeitung in Crop-Größe
751
+ all_masks_original = [] #Heuristikberechnung besser in Originalgröße!
752
 
753
  for i in range(num_masks):
754
  single_mask = outputs.pred_masks[:, :, i, :, :]
 
852
  # Exzentrizität (wie elliptisch) - Köpfe sind tendenziell elliptisch
853
  eccentricity = largest_region.eccentricity if hasattr(largest_region, 'eccentricity') else 0.5
854
 
855
+ # Perfekt runde Formen (Kreis) sind 0, Linie wäre 1
856
  # Köpfe haben typischerweise 0.5-0.8
857
  if 0.4 <= eccentricity <= 0.9:
858
  eccentricity_score = 1.0 - abs(eccentricity - 0.65) * 2
 
1073
 
1074
  print("#" * 80)
1075
 
1076
+ return mask, raw_mask #in app.py wird mask immer auf 512x512 skaliert
1077
 
1078
  # ============================================================
1079
  # UNBEKANNTER MODUS