mirror of
https://github.com/shinyobjectz/raea.git
synced 2026-12-06 05:33:38 -10:00
Place: a face the reader doubts doesn't make text over it an error (#356)
frames.ts already holds a cut face under FACE_SURE (0.8) to a warning; place.ts counted every face the reader gave. Run 34's Dutch caption over a speaker's coat was an ERROR for a "face" at 0.675 on her gloves, beside her own at 0.947. Doubtful faces now count as the body they're on (a warning). Co-authored-by: shinyobjectz <[email protected]>
This commit is contained in:
1 parent
7ef9e7d638
commit
1d90ea5743
2 files changed
+21
No files matched your search
@@ -18,6 +18,7 @@ import { check, found } from "raea/check"
|
||||
import { footageIn, type FileFacts } from "../facts.ts"
|
||||
import { RATE } from "../media.ts"
|
||||
import { quote } from "../text.ts"
|
||||
import { FACE_SURE } from "./frames.ts"
|
||||
|
||||
/** a frame's scene, as the farm reads it (deploy/modal/farm_scene.py), in the pixels of the frame it was sent */
|
||||
/** the scene reader's reading of a frame's text: [x, y, w, h, text, score] a line (the captions pack) */
|
||||
@@ -191,6 +192,9 @@ const px = (v: number, dim: number) => Math.round(v * dim)
|
||||
/** each text the render's manifest shows, against the scenes of the frames it's on (sampled `rate` a second): one
|
||||
* finding a text, when it covers a face, a thing or a person and a clearer place of its size exists */
|
||||
export function textOver(manifest: any, scenes: Scene[], rate: number): Finding[] {
|
||||
// a face the reader doubts (under FACE_SURE, as frames.ts holds a cut face) isn't one here either: 12-05, run 34's
|
||||
// Dutch caption over a coat was an error for a "face" at 0.675 on the gloves, beside the speaker's at 0.947
|
||||
scenes = scenes.map((s) => s && { ...s, faces: s.faces.filter((f) => !Number.isFinite(Number(f[5])) || Number(f[5]) >= FACE_SURE) })
|
||||
const W = Number(manifest?.width) || 1080
|
||||
const H = Number(manifest?.height) || 1920
|
||||
const fps = Number(manifest?.fps) || 30
|
||||
|
||||
@@ -81,3 +81,20 @@ test("a video's scene reading is kept beside it and read again only when the vid
|
||||
// a reading at named seconds is never the whole file's
|
||||
await assert.rejects(scene(cut, [1, 2]), /no scene reader/)
|
||||
})
|
||||
|
||||
test("a face the reader doubts doesn't make a caption over a coat an error (12-05, run 34 Dutch: 0.675 on the gloves)", () => {
|
||||
// a speaker filling a 9:16 frame (540x960 scene), her face high; a caption low, over her coat, where the reader also
|
||||
// saw a "face" at 0.675. Over the body alone the caption is a warning; the same box read at 0.95 is an error
|
||||
const cols = 9, rows = 16
|
||||
const people = Array.from({ length: rows }, (_, r) => (r >= 2 ? "9".repeat(cols) : "0".repeat(cols)))
|
||||
const sceneWith = (score: number) => ({
|
||||
w: 540, h: 960, grid: { cols, rows, people },
|
||||
things: [[0.6, 72.1, 526.1, 879.6, "person", 0.912]],
|
||||
faces: [[197.5, 175.1, 131.8, 188.8, "face", 0.947], [5, 522.2, 203.4, 291.7, "face", score]],
|
||||
}) as any
|
||||
const manifest = { width: 1080, height: 1920, fps: 30, frames: [{ frame: 0, text: [{ text: "that's still your", box: [100, 1420, 880, 110], ink: [120, 1430, 840, 90] }] }] }
|
||||
const doubted = textOver(manifest, [sceneWith(0.675)], 2)
|
||||
const sure = textOver(manifest, [sceneWith(0.95)], 2)
|
||||
assert.ok(!doubted.some((f) => f.level === "error"), JSON.stringify(doubted))
|
||||
assert.ok(sure.some((f) => f.level === "error" && f.says.includes("a face")), JSON.stringify(sure))
|
||||
})
|
||||
Reference in new issue
Block a user