From f2fbe2ae6e9fe7282fbec1b8fb87baf361839727 Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Mon, 8 Jun 2026 08:52:39 -0400 Subject: [PATCH] tweak(ml): default video frame samples 10 to 6 Operator: 10-frame max-pooled tagging on video produces a lot of noisy tags, and the sampling burns time/GPU. Drop the VIDEO_ML_FRAMES default to 6 (still env- overridable). Fewer frames = less per-frame noise into the max-pool and a smaller frame-sampling budget. Quality/perf of the whole video path is being reviewed separately. --- backend/app/tasks/ml.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/app/tasks/ml.py b/backend/app/tasks/ml.py index 3be9f7b..7703447 100644 --- a/backend/app/tasks/ml.py +++ b/backend/app/tasks/ml.py @@ -35,8 +35,8 @@ def _is_video(path: Path) -> bool: retry_backoff_max=60, retry_jitter=True, max_retries=3, - # Sized for the video branch: sample 10 frames, run tagger + - # embedder on each (≈20 GPU ops vs 2 for an image). A loaded + # Sized for the video branch: sample 6 frames, run tagger + + # embedder on each (≈12 GPU ops vs 2 for an image). A loaded # ml-worker can take 5-10 min on a long video; bumped from # 5min/7min on 2026-05-28 after operator-flagged image 6288 (a # .mp4) hit the recovery sweep at 5 min while still legitimately @@ -50,7 +50,7 @@ def tag_and_embed(self, image_id: int) -> dict: then enqueue per-image allowlist application. Video: sample frames between 10% and 90% of duration (VIDEO_ML_FRAMES, - default 10). Max-pool tagger confidences across frames, mean-pool the + default 6). Max-pool tagger confidences across frames, mean-pool the SigLIP embeddings. On no-frames returns status='no_frames' (not an error). """ import os @@ -116,7 +116,7 @@ def tag_and_embed(self, image_id: int) -> dict: phase = "video_sample_frames" t0 = time.monotonic() frames = _sample_video_frames( - src, int(os.environ.get("VIDEO_ML_FRAMES", "10")) + src, int(os.environ.get("VIDEO_ML_FRAMES", "6")) ) log.info( "tag_and_embed sampled %d frame(s) in %.1fs: %s",