Normalize visible island segments
This commit is contained in:
+1
-1
File diff suppressed because one or more lines are too long
+4
-5
File diff suppressed because one or more lines are too long
@@ -282,8 +282,25 @@ def _normalize_cached_results(beats: list, results: list, cfg) -> list:
|
||||
beat = beats_by_id.get(result.beat_id)
|
||||
if getattr(result, "segments", ()):
|
||||
segment_threshold = cfg.cv.deep_scan.multi_shot_segment_threshold
|
||||
current_islands = _reference_scoreable_segments(beat, cfg) if beat is not None else []
|
||||
repaired_segments = []
|
||||
for segment in result.segments:
|
||||
source_segments = list(result.segments)
|
||||
if beat is not None and len(source_segments) == 1 and len(current_islands) == 1:
|
||||
island_start_s, island_end_s = current_islands[0]
|
||||
island_duration_s = max(0.0, island_end_s - island_start_s)
|
||||
segment = source_segments[0]
|
||||
if (
|
||||
abs(float(segment.trailer_offset_s) - island_start_s) > 0.04
|
||||
or abs(float(segment.duration_s) - island_duration_s) > 0.08
|
||||
):
|
||||
from dataclasses import replace as _replace
|
||||
source_segments[0] = _replace(
|
||||
segment,
|
||||
trailer_offset_s=island_start_s,
|
||||
duration_s=island_duration_s,
|
||||
out_point_s=float(segment.in_point_s) + island_duration_s,
|
||||
)
|
||||
for segment in source_segments:
|
||||
if float(segment.match_score) < segment_threshold:
|
||||
scene = _scene_by_id_light(scenes, segment.scene_id)
|
||||
if beat is not None and scene is not None:
|
||||
@@ -596,7 +613,7 @@ def _reference_scoreable_segments(beat, cfg) -> list[tuple[float, float]]:
|
||||
t = 0.0
|
||||
while t <= beat.duration_s:
|
||||
frame = grab_frame_at_path(beat.trailer_path, beat.start_s + t)
|
||||
scoreable = frame is not None and _is_scoreable_reference_frame(frame, cfg)
|
||||
scoreable = frame is not None and is_visible(frame)
|
||||
if scoreable:
|
||||
if start is None:
|
||||
start = t
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 13 KiB |
Reference in New Issue
Block a user