Skip to content

animation: inkstats undercounts the final hold of a rotoscope work dir #4594

Description

@kyle-sexton

For a rotoscope work directory, inkstats.drawings() ends the last drawing one nominal frame after its start instead of at d/index.json's duration, so the final hold is undercounted (regression clip: 0.042 s counted, 0.133 s actual). Found by Codex on #4534; deferred there because the fix changes the learned woodcut-ink pack.

Fix (tested, not applied)

diff --git a/plugins/animation/scripts/inkstats.py b/plugins/animation/scripts/inkstats.py
index 06465ed4b..c1d15a83d 100755
--- a/plugins/animation/scripts/inkstats.py
+++ b/plugins/animation/scripts/inkstats.py
@@ -120,8 +120,13 @@ def drawings(film, fps, region=None, window=None):
             continue
         prev = rgb.astype(np.int16)
         yield rgb, t
-    else:   # the film ended: a video where its stream ends, anything else one frame after the last
-        t = decode.end(film) if isinstance(film, (str, Path)) and Path(film).is_file() else t + dt
+    else:   # the film ended: a video where its stream ends, a work dir at its index's duration, else one frame on
+        if isinstance(film, (str, Path)) and Path(film).is_file():
+            t = decode.end(film)
+        elif isinstance(film, (str, Path)) and decode.workdir.src(Path(film)).is_dir():
+            t = json.load(open(decode.workdir.index(Path(film)), encoding='utf-8'))['duration']
+        else:
+            t += dt
     yield None, t
 
 

Result of relearning the pack with the fix

  • controls.py check: 36/36 as required against both the old and the relearned pack; no control flips to passing. Selftest unchanged.
  • Held-out: calibration 152/152, evaluation 147/150 (was 150/150). Splits 151 (76 calibration) instead of 150.
  • offstep: band 0.0308-0.1406 (source 0.0882) becomes 0.0393-0.1242 (source 0.084), widening 0.0096 to 0.0007; the 3 held-out misses are all on this row.
  • Also moved: per_second 7.784-8.04 to 7.777-7.968 (source 7.919 to 7.895); flat 0.1305-0.7958 to 0.1057-0.819; duration 30.182 to 30.273.

To decide

Accept 147/150, or change how bands and widening are learned so held-out coverage survives the corrected statistic, then re-baseline the pack and the refactor safety net.

Related

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-humanHuman-in-the-loop required; autonomous sessions must not resolve items carrying this.priority: mediumReal value, no hard deadline; normal backlog flow.work-class: scopedA briefed fix or small feature; blast radius bounded by the brief, tests exist.

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions