Update controlnet_module.py
Browse files- controlnet_module.py +7 -2
controlnet_module.py
CHANGED
|
@@ -522,7 +522,11 @@ class ControlNetProcessor:
|
|
| 522 |
print(f" 🎯 Standard-Threshold: {dynamic_threshold:.3f}")
|
| 523 |
|
| 524 |
mask_array = (mask_np > dynamic_threshold).astype(np.uint8) * 255
|
| 525 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 526 |
# ============================================================
|
| 527 |
# MODUS-SPEZIFISCHES POSTPROCESSING
|
| 528 |
# ============================================================
|
|
@@ -658,6 +662,7 @@ class ControlNetProcessor:
|
|
| 658 |
|
| 659 |
# Zurück zu PIL Image
|
| 660 |
mask = Image.fromarray(mask_array).convert("L")
|
|
|
|
| 661 |
|
| 662 |
print("#" * 80)
|
| 663 |
print(f"✅ SAM 2 SEGMENTIERUNG ABGESCHLOSSEN")
|
|
@@ -669,7 +674,7 @@ class ControlNetProcessor:
|
|
| 669 |
print(f"👤 Kopfabdeckung: {coverage_ratio:.1%} der BBox")
|
| 670 |
|
| 671 |
print("#" * 80)
|
| 672 |
-
return mask
|
| 673 |
|
| 674 |
except Exception as e:
|
| 675 |
print("❌" * 40)
|
|
|
|
| 522 |
print(f" 🎯 Standard-Threshold: {dynamic_threshold:.3f}")
|
| 523 |
|
| 524 |
mask_array = (mask_np > dynamic_threshold).astype(np.uint8) * 255
|
| 525 |
+
|
| 526 |
+
# HIER: Rohmaske speichern (vor Smoothing)
|
| 527 |
+
raw_mask_array = mask_array.copy()
|
| 528 |
+
|
| 529 |
+
|
| 530 |
# ============================================================
|
| 531 |
# MODUS-SPEZIFISCHES POSTPROCESSING
|
| 532 |
# ============================================================
|
|
|
|
| 662 |
|
| 663 |
# Zurück zu PIL Image
|
| 664 |
mask = Image.fromarray(mask_array).convert("L")
|
| 665 |
+
raw_mask = Image.fromarray(raw_mask_array).convert("L")
|
| 666 |
|
| 667 |
print("#" * 80)
|
| 668 |
print(f"✅ SAM 2 SEGMENTIERUNG ABGESCHLOSSEN")
|
|
|
|
| 674 |
print(f"👤 Kopfabdeckung: {coverage_ratio:.1%} der BBox")
|
| 675 |
|
| 676 |
print("#" * 80)
|
| 677 |
+
return mask, raw_mask
|
| 678 |
|
| 679 |
except Exception as e:
|
| 680 |
print("❌" * 40)
|