Update controlnet_module.py
Browse files- controlnet_module.py +20 -0
controlnet_module.py
CHANGED
|
@@ -648,6 +648,26 @@ class ControlNetProcessor:
|
|
| 648 |
print(f"💾 Originalbild gesichert: {original_image.size}")
|
| 649 |
original_bbox = (x1, y1, x2, y2) # <-- DAS FEHLT
|
| 650 |
print(f"💾 Original-BBox gespeichert: {original_bbox}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 651 |
|
| 652 |
# ============================================================
|
| 653 |
# Crop = BBox × 2.5 (ERHÖHT für mehr Kontext)
|
|
|
|
| 648 |
print(f"💾 Originalbild gesichert: {original_image.size}")
|
| 649 |
original_bbox = (x1, y1, x2, y2) # <-- DAS FEHLT
|
| 650 |
print(f"💾 Original-BBox gespeichert: {original_bbox}")
|
| 651 |
+
|
| 652 |
+
|
| 653 |
+
#512x512-Bilder ohne Crop für mehr Kontext für SAM
|
| 654 |
+
use_crop_strategy = True. #Flag
|
| 655 |
+
|
| 656 |
+
if original_image.width <= 512 and original_image.height <= 512:
|
| 657 |
+
print("Bild ist 512x512 oder kleiner, verwende Originalgröße für SAM")
|
| 658 |
+
print(f" Originalgröße: {original_image.width}×{original_image.height}")
|
| 659 |
+
|
| 660 |
+
use_crop_strategy = False
|
| 661 |
+
|
| 662 |
+
else:
|
| 663 |
+
print(f"📏 Bild ist größer als 512x512 ({original_image.size}) → Verwende Crop-Strategie")
|
| 664 |
+
|
| 665 |
+
use_crop_strategy = True
|
| 666 |
+
|
| 667 |
+
if use_crop_strategy:
|
| 668 |
+
|
| 669 |
+
|
| 670 |
+
|
| 671 |
|
| 672 |
# ============================================================
|
| 673 |
# Crop = BBox × 2.5 (ERHÖHT für mehr Kontext)
|