Update controlnet_module.py
Browse files- controlnet_module.py +2 -44
controlnet_module.py
CHANGED
|
@@ -1062,51 +1062,9 @@ class ControlNetProcessor:
|
|
| 1062 |
print(f" 🎯 Kompaktheits-Analyse:")
|
| 1063 |
print(f" • Solidität (Fläche/Konvex): {solidity:.3f}")
|
| 1064 |
print(f" • Exzentrizität (Form): {eccentricity:.3f}")
|
| 1065 |
-
print(f" • Kompaktheits-Score: {compactness_score:.
|
| 1066 |
|
| 1067 |
-
|
| 1068 |
-
bbox_mask = np.zeros((image.height, image.width), dtype=np.uint8)
|
| 1069 |
-
|
| 1070 |
-
if use_crop_strategy:
|
| 1071 |
-
bbox_mask[y1:y2, x1:x2] = 1
|
| 1072 |
-
else:
|
| 1073 |
-
# Original-Fall: Müssen BBox auf aktuelle Bildgröße transformieren
|
| 1074 |
-
# Da Bild = Original, können wir original_bbox direkt verwenden
|
| 1075 |
-
bbox_mask[original_bbox[1]:original_bbox[3], original_bbox[0]:original_bbox[2]] = 1
|
| 1076 |
-
|
| 1077 |
-
|
| 1078 |
-
overlap = np.sum(mask_binary & bbox_mask)
|
| 1079 |
-
|
| 1080 |
-
#bbox_overlap_ratio = overlap / mask_area_pixels if mask_area_pixels > 0 else 0
|
| 1081 |
-
bbox_overlap_ratio = overlap / bbox_area if bbox_area > 0 else 0
|
| 1082 |
-
|
| 1083 |
-
|
| 1084 |
-
print(f" 📍 BBox-Überlappung: {overlap:,} von {mask_area_pixels:,} Pixeln ({bbox_overlap_ratio:.1%})")
|
| 1085 |
-
|
| 1086 |
-
|
| 1087 |
-
# Für Kopf: Sollte großteils in BBox sein (mind. 70%)
|
| 1088 |
-
if bbox_overlap_ratio >= 0.7:
|
| 1089 |
-
bbox_score = 1.0
|
| 1090 |
-
print(f" ✅ Hohe BBox-Überlappung: {bbox_overlap_ratio:.3f} ({overlap:,} Pixel)")
|
| 1091 |
-
elif bbox_overlap_ratio >= 0.5:
|
| 1092 |
-
bbox_score = bbox_overlap_ratio * 1.2
|
| 1093 |
-
print(f" ⚠️ Mittlere BBox-Überlappung: {bbox_overlap_ratio:.3f}")
|
| 1094 |
-
else:
|
| 1095 |
-
bbox_score = bbox_overlap_ratio * 0.8
|
| 1096 |
-
print(f" ❌ Geringe BBox-Überlappung: {bbox_overlap_ratio:.3f}")
|
| 1097 |
-
|
| 1098 |
-
# SAM-KONFIDENZ (10%)
|
| 1099 |
-
confidence_score = mask_max
|
| 1100 |
-
|
| 1101 |
-
# GESAMTSCORE für Kopf
|
| 1102 |
-
#score = (
|
| 1103 |
-
# area_score * 0.4 + # 40% Flächenpassung
|
| 1104 |
-
# compactness_score * 0.3 + # 30% Kompaktheit
|
| 1105 |
-
# bbox_score * 0.2 + # 20% BBox-Überlappung
|
| 1106 |
-
# confidence_score * 0.1 # 10% Konfidenz
|
| 1107 |
-
#)
|
| 1108 |
-
|
| 1109 |
-
|
| 1110 |
score = (
|
| 1111 |
bbox_overlap_ratio * 0.5 + # 50% BBox-Überlappung (vorher 20%)
|
| 1112 |
compactness_score * 0.3 + # 30% Kompaktheit (vorher 30%)
|
|
|
|
| 1062 |
print(f" 🎯 Kompaktheits-Analyse:")
|
| 1063 |
print(f" • Solidität (Fläche/Konvex): {solidity:.3f}")
|
| 1064 |
print(f" • Exzentrizität (Form): {eccentricity:.3f}")
|
| 1065 |
+
print(f" • Kompaktheits-Score: {compactness_score:.
|
| 1066 |
|
| 1067 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1068 |
score = (
|
| 1069 |
bbox_overlap_ratio * 0.5 + # 50% BBox-Überlappung (vorher 20%)
|
| 1070 |
compactness_score * 0.3 + # 30% Kompaktheit (vorher 30%)
|