Update controlnet_module.py
Browse files- controlnet_module.py +12 -44
controlnet_module.py
CHANGED
|
@@ -885,11 +885,11 @@ class ControlNetProcessor:
|
|
| 885 |
center_y = (y1 + y2) // 2
|
| 886 |
|
| 887 |
# Punkt im Gesicht (30% höher vom Mittelpunkt)(auch für größere BBox)
|
| 888 |
-
bbox_height = y2 - y1
|
| 889 |
-
face_offset = int(bbox_height * 0.3)
|
| 890 |
-
face_x = center_x
|
| 891 |
-
face_y = center_y - face_offset
|
| 892 |
-
face_y = max(y1 + 10, min(face_y, y2 - 10)) # In BBox halten
|
| 893 |
|
| 894 |
|
| 895 |
if is_back_head:
|
|
@@ -899,50 +899,18 @@ class ControlNetProcessor:
|
|
| 899 |
back_y = center_y + back_offset
|
| 900 |
back_y = min(back_y, y2 - 10)
|
| 901 |
|
| 902 |
-
input_points = [[[[
|
| 903 |
input_labels = [[[1, 0]]]
|
| 904 |
|
| 905 |
-
print(f" 🎯 HINTERKOPF-SAM: Positiv ({
|
| 906 |
else:
|
| 907 |
-
# 😊 GESICHT: NUR EIN Punkt
|
| 908 |
-
input_points = [[[[
|
| 909 |
input_labels = [[[1]]]
|
| 910 |
|
| 911 |
-
print(f" 🎯 GESICHTS-SAM: Punkt ({
|
| 912 |
-
|
| 913 |
-
|
| 914 |
-
|
| 915 |
-
|
| 916 |
-
|
| 917 |
-
|
| 918 |
-
|
| 919 |
-
|
| 920 |
-
|
| 921 |
-
|
| 922 |
-
|
| 923 |
-
|
| 924 |
-
|
| 925 |
-
|
| 926 |
-
|
| 927 |
-
|
| 928 |
-
|
| 929 |
-
|
| 930 |
-
|
| 931 |
-
|
| 932 |
-
# NUR EIN Punkt: Der Gesichtspunkt in der Mitte der BBox
|
| 933 |
-
input_points = [[[[center_x, center_y]]]] # EIN Punkt
|
| 934 |
-
input_labels = [[[1]]] # Ein positiver Prompt
|
| 935 |
-
|
| 936 |
-
print(f" 🎯 SAM-Prompt: BBox [{x1},{y1},{x2},{y2}]")
|
| 937 |
-
print(f" 👁️ Punkt: Nur Gesicht ({face_x},{face_y})")
|
| 938 |
-
|
| 939 |
-
# BEIDE Punkte kombinieren
|
| 940 |
-
#input_points = [[[[center_x, center_y], [face_x, face_y]]]] # ZWEI Punkte
|
| 941 |
-
#input_labels = [[[1, 1]]] # Beide sind positive Prompts
|
| 942 |
-
|
| 943 |
-
#print(f" 🎯 SAM-Prompt: BBox [{x1},{y1},{x2},{y2}]")
|
| 944 |
-
#print(f" 👁️ Punkte: Mitte ({center_x},{center_y}), Gesicht ({face_x},{face_y})")
|
| 945 |
-
|
| 946 |
# Aufruf des SAM-Prozessors mit den Variablen. Der Processor verpackt diese Rohdaten
|
| 947 |
# in die für das SAM-Modell erforderlichen Tensoren und speichert sie in inputs.
|
| 948 |
inputs = self.sam_processor(
|
|
|
|
| 885 |
center_y = (y1 + y2) // 2
|
| 886 |
|
| 887 |
# Punkt im Gesicht (30% höher vom Mittelpunkt)(auch für größere BBox)
|
| 888 |
+
#bbox_height = y2 - y1
|
| 889 |
+
#face_offset = int(bbox_height * 0.3)
|
| 890 |
+
#face_x = center_x
|
| 891 |
+
#face_y = center_y - face_offset
|
| 892 |
+
#face_y = max(y1 + 10, min(face_y, y2 - 10)) # In BBox halten
|
| 893 |
|
| 894 |
|
| 895 |
if is_back_head:
|
|
|
|
| 899 |
back_y = center_y + back_offset
|
| 900 |
back_y = min(back_y, y2 - 10)
|
| 901 |
|
| 902 |
+
input_points = [[[[center_x,center_y], [back_x, back_y]]]]
|
| 903 |
input_labels = [[[1, 0]]]
|
| 904 |
|
| 905 |
+
print(f" 🎯 HINTERKOPF-SAM: Positiv ({center_x},{center_y}), Negativ ({back_x},{back_y})")
|
| 906 |
else:
|
| 907 |
+
# 😊 GESICHT: NUR EIN positiver Punkt
|
| 908 |
+
input_points = [[[[center_x, center_y]]]]
|
| 909 |
input_labels = [[[1]]]
|
| 910 |
|
| 911 |
+
print(f" 🎯 GESICHTS-SAM: Punkt ({center_x},{center_y})")
|
| 912 |
+
|
| 913 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 914 |
# Aufruf des SAM-Prozessors mit den Variablen. Der Processor verpackt diese Rohdaten
|
| 915 |
# in die für das SAM-Modell erforderlichen Tensoren und speichert sie in inputs.
|
| 916 |
inputs = self.sam_processor(
|