Spaces:
Running
on
Zero
Running
on
Zero
Update scene_scoring_engine.py
Browse files- scene_scoring_engine.py +11 -11
scene_scoring_engine.py
CHANGED
@@ -255,7 +255,7 @@ class SceneScoringEngine:
|
|
255 |
# 檢查地標相關分數是否達到門檻,如果是,直接回傳 "tourist_landmark"
|
256 |
# 假設場景分數 dictionary 中,"tourist_landmark"、"historical_monument"、"natural_landmark" 三個 key
|
257 |
# 分別代表不同類型地標。將它們加總,若總分超過 0.3,就認定為地標場景。
|
258 |
-
print(f"DEBUG: determine_scene_type input scores: {scene_scores}")
|
259 |
landmark_score = (
|
260 |
scene_scores.get("tourist_landmark", 0.0) +
|
261 |
scene_scores.get("historical_monument", 0.0) +
|
@@ -268,7 +268,7 @@ class SceneScoringEngine:
|
|
268 |
# 找分數最高的那個場景
|
269 |
best_scene = max(scene_scores, key=scene_scores.get)
|
270 |
best_score = scene_scores[best_scene]
|
271 |
-
print(f"DEBUG: determine_scene_type result: scene={best_scene}, score={best_score}")
|
272 |
return best_scene, float(best_score)
|
273 |
|
274 |
def fuse_scene_scores(self, yolo_scene_scores: Dict[str, float],
|
@@ -294,12 +294,12 @@ class SceneScoringEngine:
|
|
294 |
"""
|
295 |
# 處理其中一個分數字典可能為空或所有分數實際上為零的情況
|
296 |
# 提取和處理 Places365 場景分數
|
297 |
-
print(f"DEBUG: fuse_scene_scores input - yolo_scores: {yolo_scene_scores}")
|
298 |
-
print(f"DEBUG: fuse_scene_scores input - clip_scores: {clip_scene_scores}")
|
299 |
-
print(f"DEBUG: fuse_scene_scores input - num_yolo_detections: {num_yolo_detections}")
|
300 |
-
print(f"DEBUG: fuse_scene_scores input - avg_yolo_confidence: {avg_yolo_confidence}")
|
301 |
-
print(f"DEBUG: fuse_scene_scores input - lighting_info: {lighting_info}")
|
302 |
-
print(f"DEBUG: fuse_scene_scores input - places365_info: {places365_info}")
|
303 |
|
304 |
places365_scene_scores_map = {} # 修改變數名稱以避免與傳入的字典衝突
|
305 |
if places365_info and places365_info.get('confidence', 0) > 0.1:
|
@@ -361,8 +361,8 @@ class SceneScoringEngine:
|
|
361 |
current_yolo_weight = default_yolo_weight
|
362 |
current_clip_weight = default_clip_weight
|
363 |
current_places365_weight = default_places365_weight
|
364 |
-
print(f"DEBUG: Scene {scene_type} - yolo_score: {yolo_score}, clip_score: {clip_score}, places365_score: {places365_score}")
|
365 |
-
print(f"DEBUG: Scene {scene_type} - weights: yolo={current_yolo_weight:.3f}, clip={current_clip_weight:.3f}, places365={current_places365_weight:.3f}")
|
366 |
|
367 |
scene_definition = self.scene_types.get(scene_type, {})
|
368 |
|
@@ -491,7 +491,7 @@ class SceneScoringEngine:
|
|
491 |
fused_scores[scene_type] = min(1.0, max(0.0, fused_score))
|
492 |
|
493 |
return fused_scores
|
494 |
-
print(f"DEBUG: fuse_scene_scores final result: {fused_scores}")
|
495 |
|
496 |
def update_enable_landmark_status(self, enable_landmark: bool):
|
497 |
"""
|
|
|
255 |
# 檢查地標相關分數是否達到門檻,如果是,直接回傳 "tourist_landmark"
|
256 |
# 假設場景分數 dictionary 中,"tourist_landmark"、"historical_monument"、"natural_landmark" 三個 key
|
257 |
# 分別代表不同類型地標。將它們加總,若總分超過 0.3,就認定為地標場景。
|
258 |
+
# print(f"DEBUG: determine_scene_type input scores: {scene_scores}")
|
259 |
landmark_score = (
|
260 |
scene_scores.get("tourist_landmark", 0.0) +
|
261 |
scene_scores.get("historical_monument", 0.0) +
|
|
|
268 |
# 找分數最高的那個場景
|
269 |
best_scene = max(scene_scores, key=scene_scores.get)
|
270 |
best_score = scene_scores[best_scene]
|
271 |
+
# print(f"DEBUG: determine_scene_type result: scene={best_scene}, score={best_score}")
|
272 |
return best_scene, float(best_score)
|
273 |
|
274 |
def fuse_scene_scores(self, yolo_scene_scores: Dict[str, float],
|
|
|
294 |
"""
|
295 |
# 處理其中一個分數字典可能為空或所有分數實際上為零的情況
|
296 |
# 提取和處理 Places365 場景分數
|
297 |
+
# print(f"DEBUG: fuse_scene_scores input - yolo_scores: {yolo_scene_scores}")
|
298 |
+
# print(f"DEBUG: fuse_scene_scores input - clip_scores: {clip_scene_scores}")
|
299 |
+
# print(f"DEBUG: fuse_scene_scores input - num_yolo_detections: {num_yolo_detections}")
|
300 |
+
# print(f"DEBUG: fuse_scene_scores input - avg_yolo_confidence: {avg_yolo_confidence}")
|
301 |
+
# print(f"DEBUG: fuse_scene_scores input - lighting_info: {lighting_info}")
|
302 |
+
# print(f"DEBUG: fuse_scene_scores input - places365_info: {places365_info}")
|
303 |
|
304 |
places365_scene_scores_map = {} # 修改變數名稱以避免與傳入的字典衝突
|
305 |
if places365_info and places365_info.get('confidence', 0) > 0.1:
|
|
|
361 |
current_yolo_weight = default_yolo_weight
|
362 |
current_clip_weight = default_clip_weight
|
363 |
current_places365_weight = default_places365_weight
|
364 |
+
# print(f"DEBUG: Scene {scene_type} - yolo_score: {yolo_score}, clip_score: {clip_score}, places365_score: {places365_score}")
|
365 |
+
# print(f"DEBUG: Scene {scene_type} - weights: yolo={current_yolo_weight:.3f}, clip={current_clip_weight:.3f}, places365={current_places365_weight:.3f}")
|
366 |
|
367 |
scene_definition = self.scene_types.get(scene_type, {})
|
368 |
|
|
|
491 |
fused_scores[scene_type] = min(1.0, max(0.0, fused_score))
|
492 |
|
493 |
return fused_scores
|
494 |
+
# print(f"DEBUG: fuse_scene_scores final result: {fused_scores}")
|
495 |
|
496 |
def update_enable_landmark_status(self, enable_landmark: bool):
|
497 |
"""
|