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:
@@ -95,7 +95,15 @@ def load_pred_intervals(pred_json: dict):
|
||||
for a in pred_json.get("actors", []):
|
||||
keys = frozenset(keys_for(imdb_id=a.get("imdb_id"), tmdb_id=a.get("tmdb_id"),
|
||||
jellyfin_id=a.get("jellyfin_id"), name=a.get("name")))
|
||||
out.append((keys, [(float(t0), float(t1)) for t0, t1 in a.get("scenes", [])]))
|
||||
# schema_version 1: scenes is [[t0, t1], ...]; schema_version 2:
|
||||
# scenes is [{"start":…, "end":…, "belief":…, "route":…}, …].
|
||||
windows = []
|
||||
for s in a.get("scenes", []):
|
||||
if isinstance(s, dict):
|
||||
windows.append((float(s["start"]), float(s["end"])))
|
||||
else:
|
||||
windows.append((float(s[0]), float(s[1])))
|
||||
out.append((keys, windows))
|
||||
return out
|
||||
|
||||
|
||||
|
||||
@@ -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})
|
||||
|
||||
Reference in New Issue
Block a user