Repository navigation
feat(onscreen): sample, classify and group on-screen text - #19
anthony-hermes[bot] wants to merge 8 commits into
Conversation
Lane 10's core rules, tests first, on top of the pipeline types: - sample_times is one frame per whole second inside the duration (OS10.1) - is_dialogue_caption compares normalised text with speech in the same second and drops a match, keeping everything else (OS10.3) - group_cards joins identical text on consecutive frames, holds a card to at least 2200 ms, caps it at 8000 ms and stops 100 ms before a later card (OS10.2, OS10.4); cards that start on the same frame stay side by side - attribution cards keep kind = attribution, leave the translated set and are named in the QA block (OS10.9) - run_onscreen writes onscreen.json atomically; engine = off writes [] and a note that names the omission (OS10.5) - OcrEngine is a protocol reporting its execution provider (OS10.6); the lane runs end to end on FakeEngine and FakeFrameSource with no model, no network and no ffmpeg (OS10.8, OS10.10)
|
Trimmed the onscreen tests to observable cards and QA output.
215 tests, |
Resolved tests/pipeline/test_cues.py, test_prompt.py and test_speakers.py by taking master's copy for every pipeline test file. The suite trim lives in #23, so this branch carries no pipeline test change after the merge; its own diff is the ten onscreen files.
read_once and frames_once lost their only caller when the internal shape checks were cut, and the OS10.8 section header they lived under was left dangling. Card.duration_ms and Card.is_attribution had no caller either. The redundant `second.start_ms - first.end_ms == 100` assertion was implied by the two absolute bounds asserted above it.
Hermes PR ReviewReviewed commit: Review status: Pass 3 of 3 complete. PR-001 to PR-004 are verified fixed. One new Low finding, PR-005, is open and recorded as a forced tradeoff, not a blocker. No Critical or High finding is unresolved. This is not an approval; the merge decision is the repository owner's. Executive summaryPR #19 adds lane 10's on-screen-text core as ten new files: seven under
Every previous finding is verified fixed by direct probes on the reviewed tree, not by reading fix notes:
One new Low finding, PR-005, is the known cost of the colon-less Korean branch added for PR-004: a card that opens with FindingsPR-005 (Low, confidence medium, confirmed, open, correction disputed): Space-separated Korean credit rule drops ordinary informational cards from translationFile: Problem: Evidence, reproduced by the coordinator: on the reviewed tree, Impact: one class of Korean informational card is written to Coordinator ruling, correction disputed: the suggested correction is to require a Latin or digit token, or a name-like remainder, after the space. That would drop Korean credited parties written in Hangul, for example Previously reported findings
Verification
The reviewer child could not read the PR description: its Implementation walkthroughOverview. Lane 10 turns sampled video frames into Execution flow. Decisions. Equality rather than containment for speech matching; anchored credit labels with a separator requirement, so Assumptions. Text must appear on consecutive one-second samples to form one card. The hold rules and the 100 ms gap define the timeline. Non-credit cards are the translation set. Changed files
Assumptions and risks
Recommended human review order
This is not an approval, and no formal review event was submitted on the forge. |
Attribution is now the label that opens a card, followed by a separator, `by`, or the end of the text, so `Resource Center` and `Photo Zone` stay graphics instead of being dropped from translation (PR-001). A dialogue caption must equal the normalised speech, not sit inside it, so a nameplate `Kim` survives the second where someone says "Kim arrived at the station." (PR-003). A caption split across two segments still matches, because the segments of the second are joined and compared as well. Every card is clamped against the next card that starts later, not merely the next card in the list, so all same-frame cards stop 100 ms before a later card instead of one of them dropping below the 2200 ms hold (PR-002). make check: exit 0. python -m pytest: 375 passed, 7 deselected.
OS10.9 false-negative edge of the anchored attribution rule: `Photo Credit: Jane Doe`, `Image Source: Unsplash`, `Credit Photo: Kim`, `Photos: MBC`, `자료 출처: MBC`, `자료출처: MBC`, `사진제공: MBC` and `• 출처: MBC` were graphics, so they reached the translated set. A label is now up to three credit words in sequence with an optional plural `s` on the Latin ones, leading decoration is ignored, and a Hangul label ending in `출처` or `제공` counts when the credited party follows a space, because Korean credit lines omit the colon. The separator, `by` and end-of-card rule that keeps `Photo Zone`, `Resource Center` and `Video Zone` graphics is unchanged.
Lane 10, the part that needs no model: sampling, classification, grouping and the engine seam.
OcrEngineprotocol with aproviderproperty, and a fake in the tests.Photo Credit,Image Source,자료 출처,사진제공), an optional pluralson the Latin ones, leading decoration ignored. The label only counts when a separator,by, the end of the card, or (for a Hangul label ending in출처or제공) a space and the credited party follows. They are kept withkind = attribution, excluded from translation, and counted in QA; a caption that merely contains a credit word (Resource Center,Photo Zone,Video Zone) stays a graphic.onscreen.jsonwriter, and anoffengine that writes an empty list plus a QA note.Scope.
git diff --name-only origin/master...HEADis sevensrc/subsmith/onscreen/files and threetests/onscreen/files, and nothing else. The pipeline test-suite trim that travelled on this branch has moved out of this PR to #23 (test/behavior-only); everytests/pipeline/file here is master's copy.Merged master.
git merge origin/master(c732ff2) resolvedtests/pipeline/test_cues.py,test_prompt.pyandtest_speakers.pyby taking master's copy, which restores theMAX_DIALOGUE_LINESassertions master added and the glossary-blocked test. No conflict markers remain andgit merge-tree --write-tree origin/master HEADreports no conflict.Review pass 1 findings, fixed on this branch.
PR-001Attribution was a substring test over the whole card, soResource CenterandPhoto Zonewere treated as credits and left untranslated. It is now a compiled pattern anchored at the start of the card with a required separator,by, or end.PR-002The collision clamp compared each card only with the next card in the list, so with two fragments on frame 0 and one at 1000, one same-frame card fell to 900 ms and the other overlapped the later card. Each card is now clamped against the next start time strictly greater than its own, found by bisect over the distinct start times.PR-003Dialogue classification used containment, so a nameplateKimwas dropped during a second whose speech wasKim arrived at the station.It compares for equality now, against each segment and against the joined segments of the second.Each fix carries a test that fails on the old behaviour:
test_a_caption_that_only_contains_a_credit_word_is_a_graphic,test_same_frame_cards_each_stop_before_a_later_card,test_a_graphic_whose_text_occurs_inside_speech_is_kept, andtest_a_caption_split_across_two_segments_matches_the_joined_speech.Review pass 2 finding, fixed on this branch.
PR-004The anchored rule was the false-negative edge of thePR-001fix:Photo Credit: Jane Doe,Image Source: Unsplash,Credit Photo: Kim,Photos: MBC,자료 출처: MBC,자료출처: MBC,사진제공: MBC,출처 MBC 뉴스and• 출처: MBCclassified as graphics, entered the translated set and dropped out ofqa.attribution, which OS10.9 forbids. A label is now a chain of up to three credit words (ATTRIBUTION_WORDS), Latin plurals are accepted, leading decoration is ignored, and a Hangul label ending in출처or제공takes the credited party after a space, because Korean credit lines omit the colon. Everything fromPR-001still holds: the separator requirement is unchanged, andResource Center,Photo Zone,Photography Class,Credit card accepted,Video Zone,Source of the Nileand사진 잘 찍었네remain graphics.Tests:
test_a_credit_label_with_a_qualifier_or_decoration_is_an_attribution, the extendedtest_a_caption_that_only_contains_a_credit_word_is_a_graphic, andtest_compound_credit_lines_leave_the_translated_set, which drivesrun_onscreen()and asserts both compound credits arekind = attribution, absent fromtranslated_cards()and present inqa.attribution, whilePhoto Zonestays a graphic.Residual tradeoff, stated rather than hidden: a Korean card that opens with
출처or제공and continues after a space is read as a credit, so a caption like출처 표기 방법would not be translated. The alternative, requiring a colon, drops real Korean credits, which is the failure OS10.9 forbids.Verification at
f127499(on forge, project venv on PATH):make checkexit 0, ruff format, ruff check and mypy clean,393 passed, 7 deselected. No model, no network, no ffmpeg in any test.The ONNX engine is the next PR in the stack, based on this branch.