fix(eval): read schema-v2 scene windows

The output schema moved to version 2, where each actor's "scenes" is a
list of {start, end, belief, route} objects rather than [t0, t1] pairs.
Both scorers still unpacked pairs and raised "too many values to unpack
(expected 2, got 4)" on current output. Read either form: an object's
start/end, or a two-element list. Fixes second_score.py (the optimizer's
per-second scorer) and sample_eval.py (the X-Ray/MovieNet presence eval).
This commit is contained in:
2026-08-09 10:21:56 +02:00
parent d113c83189
commit 84513d3fa7
2 changed files with 18 additions and 2 deletions
+9 -1
View File
@@ -61,7 +61,15 @@ class Prediction:
keys = keys_for(imdb_id=a.get("imdb_id"), tmdb_id=a.get("tmdb_id"),
jellyfin_id=a.get("jellyfin_id"), name=a.get("name"),
crosswalk=crosswalk)
windows = [(float(t0), float(t1)) for t0, t1 in a.get("scenes", [])]
# schema_version 1: scenes is [[t0, t1], ...] (list of pairs)
# schema_version 2: scenes is [{"start":…, "end":…, "belief":…, …}, …]
windows = []
for s in a.get("scenes", []):
if isinstance(s, dict):
windows.append((float(s["start"]), float(s["end"])))
else:
t0, t1 = s[0], s[1]
windows.append((float(t0), float(t1)))
for _, t1 in windows:
self._max_t = max(self._max_t, t1)
self.actors.append({"keys": keys, "windows": windows})