Update controlnet_module.py
Browse files- controlnet_module.py +6 -1
controlnet_module.py
CHANGED
|
@@ -1133,7 +1133,7 @@ class ControlNetProcessor:
|
|
| 1133 |
if coverage_ratio < 0.9:
|
| 1134 |
print(f" ⚠️ Maske zu dünn für Gesicht (<90%)")
|
| 1135 |
print(f" 📈 Zusätzlicher Dilate...")
|
| 1136 |
-
kernel_extra = np.ones((
|
| 1137 |
mask_array = cv2.dilate(mask_array, kernel_extra, iterations=1)
|
| 1138 |
|
| 1139 |
# Nochmal weichzeichnen
|
|
@@ -1164,6 +1164,11 @@ class ControlNetProcessor:
|
|
| 1164 |
# ============================================================
|
| 1165 |
print("📊 FINALE MASKEN-STATISTIK")
|
| 1166 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1167 |
# Weiße Pixel zählen
|
| 1168 |
final_white = np.sum(mask_array > 128)
|
| 1169 |
final_coverage = final_white / bbox_area if bbox_area > 0 else 0
|
|
|
|
| 1133 |
if coverage_ratio < 0.9:
|
| 1134 |
print(f" ⚠️ Maske zu dünn für Gesicht (<90%)")
|
| 1135 |
print(f" 📈 Zusätzlicher Dilate...")
|
| 1136 |
+
kernel_extra = np.ones((35, 35), np.uint8)
|
| 1137 |
mask_array = cv2.dilate(mask_array, kernel_extra, iterations=1)
|
| 1138 |
|
| 1139 |
# Nochmal weichzeichnen
|
|
|
|
| 1164 |
# ============================================================
|
| 1165 |
print("📊 FINALE MASKEN-STATISTIK")
|
| 1166 |
|
| 1167 |
+
# Nach den Dilate-Operationen:
|
| 1168 |
+
expanded_pixels = np.sum(mask_array > 128) - current_white
|
| 1169 |
+
print(f" 📈 Maske um {expanded_pixels:,} Pixel erweitert")
|
| 1170 |
+
print(f" 📏 Neue Kanten: ~{25//2}px von Original-Maske entfernt")
|
| 1171 |
+
|
| 1172 |
# Weiße Pixel zählen
|
| 1173 |
final_white = np.sum(mask_array > 128)
|
| 1174 |
final_coverage = final_white / bbox_area if bbox_area > 0 else 0
|