Skip to content

Fix face misses in subtitle placement - #63

Merged
IsraelWebDev merged 1 commit into
mainfrom
face-recall
Nov 23, 2026
Merged

IsraelWebDev merged 1 commit into
mainfrom
face-recall

Conversation

@IsraelWebDev

Copy link
Copy Markdown
Owner

Fix face misses in subtitle placement

On a real 3-minute talking-head excerpt, the Haar face finder found the speaker in only about half of single frames. The earlier "46 of 50 cues found a face" was mostly the avatar icons down the left edge, not the speaker. A caption checked at one midpoint frame could land on a face the finder had missed (the 62 s caption did).

Change

  • Each caption is checked at five frames across its life (FACE_SAMPLES), and a face seen in any of them keeps the caption off it.
  • When no face is seen in any sampled frame, the caption stays at bottom instead of the least busy place. For a talking head the face is seldom low.
  • The audit records the frame count per cue (faces.frames).

Measured on the excerpt (sandbox, OpenCV 4.10 Haar)

  • Speaker found in at least one sampled frame: 34 of 50 cues with 9 or 13 frames per cue, 33 of 50 with 5. More samples gained nothing, so five stays. The remaining misses are long stretches where the cascade fails.
  • Settings tried and rejected: minNeighbors 3, scaleFactor 1.05, histogram equalisation, 2x upscaling, and the alt / alt2 cascades (alone or in a union). None raised per-frame recall materially.
  • Result: all 50 captions at bottom, clear of his face, including the 62 s cue. Checked by eye on that frame.

Limits

  • Haar still misses the speaker on some stretches. The fallback keeps those captions at bottom, which is right for this framing, not for every framing.
  • Avatar-like icons count as faces and can block a caption. They are not separated from the speaker.

Tests

  • tests/test_faces.py: a face seen in only one sampled frame keeps the caption off it; sampling spans the caption; no face gives bottom with the reason; the rest as before.
  • Lint clean. Tests pass with and without OpenCV 4.10.

Generated by Claude Code

…face is seen

The face finder missed the speaker on a real talking-head excerpt. Haar finds him in about half of single frames
(94 of 180 one-per-second frames, outside the icon column). A single midpoint frame therefore missed him on
many cues, and the 62 s caption sat across his mouth.

Now each caption is checked at five frames across its life, and a face seen in any of them keeps the caption
off it. When no face is seen in any frame, the caption stays at bottom instead of the least busy place, which
could land on an unseen face. Sampling nine frames gained nothing (34 of 50 cues either way), so five stays.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017qYKdYke3ySSZS76W9Tp34
@IsraelWebDev
IsraelWebDev merged commit 80efc75 into main Nov 23, 2026
4 checks passed
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