Astridkraft commited on
Commit
f5de775
·
verified ·
1 Parent(s): 6109ac9

Update controlnet_module.py

Browse files
Files changed (1) hide show
  1. controlnet_module.py +4 -2
controlnet_module.py CHANGED
@@ -557,7 +557,7 @@ class ControlNetProcessor:
557
  # Fallback bei leerer Maske, der höchste Wert ist 0 also schwarz
558
  if mask_array.max() == 0:
559
  print(" ⚠️ Maske leer, erstelle rechteckige Fallback-Maske")
560
- mask_array = np.zeros((512, 512), dtype=np.uint8)
561
  # BBox auf 512x512 skalieren für Fallback
562
  scale_x = 512 / image.width
563
  scale_y = 512 / image.height
@@ -570,6 +570,8 @@ class ControlNetProcessor:
570
  # Damit wird die Rohmaske für die UI-Anzeige gespeichert
571
  raw_mask_array = mask_array.copy()
572
 
 
 
573
  ###################################################
574
  # POSTPROCESSING (Originalgröße)
575
  ###################################################
@@ -607,7 +609,7 @@ class ControlNetProcessor:
607
  mask_original = Image.fromarray(mask_array).convert("L")
608
  raw_mask = Image.fromarray(raw_mask_array).convert("L")
609
 
610
- # Finale Maske für ControlNet ist 512x512
611
  mask = mask_original
612
 
613
  print(f"✅ FOCUS_CHANGE Maske erstellt: {mask.size}")
 
557
  # Fallback bei leerer Maske, der höchste Wert ist 0 also schwarz
558
  if mask_array.max() == 0:
559
  print(" ⚠️ Maske leer, erstelle rechteckige Fallback-Maske")
560
+ mask_array = np.zeros((image.height, image.width), dtype=np.uint8)
561
  # BBox auf 512x512 skalieren für Fallback
562
  scale_x = 512 / image.width
563
  scale_y = 512 / image.height
 
570
  # Damit wird die Rohmaske für die UI-Anzeige gespeichert
571
  raw_mask_array = mask_array.copy()
572
 
573
+ print(f"🔧 FOCUS_CHANGE POSTPROCESSING (auf {image.width}×{image.height})")
574
+
575
  ###################################################
576
  # POSTPROCESSING (Originalgröße)
577
  ###################################################
 
609
  mask_original = Image.fromarray(mask_array).convert("L")
610
  raw_mask = Image.fromarray(raw_mask_array).convert("L")
611
 
612
+ # Finale Maske für ControlNet
613
  mask = mask_original
614
 
615
  print(f"✅ FOCUS_CHANGE Maske erstellt: {mask.size}")