Skip to content

Feat/chunked preprocessing - #2

Merged
Hilda-Azimi merged 3 commits into
mainfrom
feat/chunked-preprocessing
Sep 22, 2026
Merged

Hilda-Azimi merged 3 commits into
mainfrom
feat/chunked-preprocessing

Conversation

@Hilda-Azimi

Copy link
Copy Markdown
Collaborator

What this is

Implements option 2 from the preprocessing-scale discussion: chunked
parallel processing, built in now so future methods inherit it.

With --workers N (Reproducible-Run default: 8) the video is split into
N contiguous frame ranges; each worker (own process, explicit spawn
context) decodes its range, applies the transform, and encodes its own
lossless part; parts are joined by ffmpeg stream copy (no
re-encode). --workers 1 is the original sequential path, unchanged.

Why the output is trustworthy

  • Transforms are per-frame and every step is lossless, so chunk
    boundaries cannot leave fingerprints — and test_chunked_parity.py
    proves it: chunked vs sequential decoded frame-by-frame, max abs
    pixel diff asserted == 0
    , on a video whose frame count doesn't
    divide evenly by the worker count.
  • Loud failure on every ambiguity: invalid container metadata
    (fps/width/height/frame-count), a chunk seek that doesn't land exactly
    on its start frame, short reads, and any joined-output frame-count
    mismatch. No silent guessing (the old fps→60 fallback is gone).

Also in this PR

  • Reproducible-Run defaults now perform the standard eye pass (method
    clahe, glob **/*[eE]ye*.mp4, training-recipe parameters); none
    is a fast bypass (manifest only, no 164 GB copying) — pipeline
    wiring should route none sessions to the original asset (noted for
    the integration design).
  • run maps App Panel positionals → CLI flags with safe defaults
    (panel field order documented in the script).
  • README rewritten to match the code (incl. the CLAHE parameter
    explanations from the skeleton-PR review); __pycache__ gitignored.
  • preprocessing.json now records workers + per-chunk frame counts.

Validation

  • 6 tests pass in-capsule (3 CLAHE-recipe parity, 3 chunking), no
    warnings.
  • Live: the 249,916-frame golden eye video, 8 workers, ~20 min
    wall-clock (~26 frames/s/worker), all chunks uniform, frame counts
    verified.

Known follow-up (deliberately deferred)

Chunking assumes per-frame transforms — true of both current methods. A
future method with temporal dependencies should declare itself
sequential via a registry flag (1-line extension when such a method
exists).

…abel; README rewritten to match code; ignore __pycache__

- explicit spawn context for chunk workers (no fork-from-threads warnings)
- per-video 'video facts' line (dims, fps, frames, duration); throughput
  logged as 'frames/s processed' (distinct from the video's fps)
- README documents run-vs-CLI defaults, none=bypass, chunking design,
  and the loud-failure guards
- __pycache__/.pytest_cache untracked and gitignored
@Hilda-Azimi
Hilda-Azimi requested review from sharmishtaa and a lite review from Copilot and removed request for Copilot September 21, 2026 18:52
Comment thread code/run
@Hilda-Azimi
Hilda-Azimi merged commit 02e3e51 into main Sep 22, 2026
1 check passed
@Hilda-Azimi
Hilda-Azimi deleted the feat/chunked-preprocessing branch September 22, 2026 21:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants