Use motion phase for in-scene timing

This commit is contained in:
Melbar
2026-05-02 17:59:18 +02:00
parent 3ea5582b49
commit a5a84a9145
3 changed files with 80 additions and 8 deletions
+9 -3
View File
@@ -640,7 +640,7 @@ def _filter_semantically_invalid_vision_matches(results: list, beats: list, cfg)
from dataclasses import replace
from src.llm.vision_cache import find_action_window_in_scene, validate_match_window_with_vision
from src.cv.scene_indexer import build_scene_index
from src.cv.global_scan import align_in_point_by_content
from src.cv.global_scan import align_in_point_by_content, align_in_point_by_motion
logger = logging.getLogger(__name__)
beats_by_id = {beat.beat_id: beat for beat in beats}
@@ -655,12 +655,18 @@ def _filter_semantically_invalid_vision_matches(results: list, beats: list, cfg)
return None
start_s, end_s, semantic_score, reason = found
window_s = max(1.0, min(4.0, (end_s - start_s) * 1.5))
aligned_in_s, content_score = align_in_point_by_content(
motion_in_s, motion_score = align_in_point_by_motion(
check_beat,
start_s,
cfg,
search_window_s=window_s,
)
aligned_in_s, content_score = align_in_point_by_content(
check_beat,
motion_in_s,
cfg,
search_window_s=min(window_s, 0.8),
)
aligned_in_s = max(scene.start_s, min(aligned_in_s, max(scene.start_s, scene.end_s - check_beat.duration_s)))
ok, verify_reason = validate_match_window_with_vision(
check_beat,
@@ -679,7 +685,7 @@ def _filter_semantically_invalid_vision_matches(results: list, beats: list, cfg)
verify_reason,
)
return None
score = max(content_score, min(0.99, semantic_score))
score = max(content_score, min(0.99, semantic_score * 0.75 + motion_score * 0.25))
return scene, aligned_in_s, score, f"{reason}; {verify_reason}"
kept = []