curu-caption 3.4.2__tar.gz → 3.5.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {curu_caption-3.4.2 → curu_caption-3.5.0}/Cargo.lock +3 -3
- {curu_caption-3.4.2 → curu_caption-3.5.0}/Cargo.toml +1 -1
- {curu_caption-3.4.2 → curu_caption-3.5.0}/PKG-INFO +4 -4
- {curu_caption-3.4.2 → curu_caption-3.5.0}/pyproject.toml +15 -7
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/commands/corpus_cli.py +5 -1
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/corpus/bundle.py +20 -7
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/corpus/timeline.py +16 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/corpus/timeline_av.py +10 -1
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/corpus/timeline_visual.py +70 -17
- {curu_caption-3.4.2 → curu_caption-3.5.0}/LICENSE +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/README.md +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/crates/curu-core/Cargo.toml +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/crates/curu-core/assets/SEETAFACE_MODEL_LICENSE +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/crates/curu-core/assets/seeta_fd_frontal_v1.0.bin +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/crates/curu-core/benches/filter_1080p.rs +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/crates/curu-core/benches/frame_extraction.rs +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/crates/curu-core/benches/similarity.rs +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/crates/curu-core/src/aesthetic.rs +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/crates/curu-core/src/ahash.rs +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/crates/curu-core/src/atomic_write.rs +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/crates/curu-core/src/backpressure.rs +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/crates/curu-core/src/blur_type.rs +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/crates/curu-core/src/clip.rs +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/crates/curu-core/src/decode.rs +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/crates/curu-core/src/embed.rs +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/crates/curu-core/src/error.rs +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/crates/curu-core/src/face.rs +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/crates/curu-core/src/filter.rs +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/crates/curu-core/src/histogram.rs +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/crates/curu-core/src/lib.rs +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/crates/curu-core/src/phash.rs +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/crates/curu-core/src/quality.rs +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/crates/curu-core/src/shard_layout.rs +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/crates/curu-core/src/sharpness.rs +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/crates/curu-core/src/shot.rs +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/crates/curu-core/src/sobel.rs +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/crates/curu-ondisk/Cargo.toml +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/crates/curu-ondisk/src/atomic_write.rs +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/crates/curu-ondisk/src/facts.rs +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/crates/curu-ondisk/src/lib.rs +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/crates/curu-ondisk/src/png_meta.rs +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/__init__.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/__main__.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/_core.pyi +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/_tui_launcher.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/adapters/__init__.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/adapters/_vision_media.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/adapters/combined_captioner.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/adapters/embeddinggemma.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/adapters/vision_service.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/adapters/vlm_captioner.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/adapters/vlm_judge.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/adapters/wd14_tagger.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/aitk/__init__.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/aitk/emitter.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/audio_models.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/batch.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/caption_grounding.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/cli.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/comfy/__init__.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/comfy/infer.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/comfy/workflow.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/commands/__init__.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/commands/comfy.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/commands/media.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/config.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/content_version.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/corpus/__init__.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/corpus/audio_extractors.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/corpus/avdm_adapter.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/corpus/bundle_review.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/corpus/cheap_extractors.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/corpus/claim_check.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/corpus/conform.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/corpus/cull.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/corpus/cut.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/corpus/derive.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/corpus/encode.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/corpus/enrich.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/corpus/extractors.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/corpus/motion.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/corpus/music.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/corpus/origin.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/corpus/probe.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/corpus/projection.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/corpus/provenance.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/corpus/review_page.html +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/corpus/role.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/corpus/select.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/corpus/shot_frames.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/corpus/sound_fusion.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/corpus/speech.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/corpus/store.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/corpus/timeline_audio.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/corpus/trainer_config.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/corpus/trainers.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/corpus/window.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/curation/__init__.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/curation/dedup.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/curation/judge.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/facts.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/infra.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/local_staging_sync.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/media_extensions.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/meta.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/models.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/ort_providers.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/pipeline.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/ports/__init__.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/ports/captioning.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/ports/judging.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/ports/tagging.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/progress_report.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/quality.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/shard_layout.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/sidecar.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/staged_processing.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/video/__init__.py +0 -0
- {curu_caption-3.4.2 → curu_caption-3.5.0}/src/curu_caption/video/midpoint_frame.py +0 -0
|
@@ -495,7 +495,7 @@ checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5"
|
|
|
495
495
|
|
|
496
496
|
[[package]]
|
|
497
497
|
name = "curu-core"
|
|
498
|
-
version = "3.
|
|
498
|
+
version = "3.5.0"
|
|
499
499
|
dependencies = [
|
|
500
500
|
"anyhow",
|
|
501
501
|
"crc32fast",
|
|
@@ -519,7 +519,7 @@ dependencies = [
|
|
|
519
519
|
|
|
520
520
|
[[package]]
|
|
521
521
|
name = "curu-ondisk"
|
|
522
|
-
version = "3.
|
|
522
|
+
version = "3.5.0"
|
|
523
523
|
dependencies = [
|
|
524
524
|
"anyhow",
|
|
525
525
|
"crc32fast",
|
|
@@ -532,7 +532,7 @@ dependencies = [
|
|
|
532
532
|
|
|
533
533
|
[[package]]
|
|
534
534
|
name = "curu-tui"
|
|
535
|
-
version = "3.
|
|
535
|
+
version = "3.5.0"
|
|
536
536
|
dependencies = [
|
|
537
537
|
"anyhow",
|
|
538
538
|
"clap",
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: curu-caption
|
|
3
|
-
Version: 3.
|
|
4
|
-
Requires-Dist: avdm>=0.
|
|
5
|
-
Requires-Dist: curu-vision[gpu]>=0.
|
|
3
|
+
Version: 3.5.0
|
|
4
|
+
Requires-Dist: avdm>=0.4.0,<0.5
|
|
5
|
+
Requires-Dist: curu-vision[gpu]>=0.37.0,<0.38
|
|
6
6
|
Requires-Dist: av>=17
|
|
7
7
|
Requires-Dist: click>=8
|
|
8
8
|
Requires-Dist: curu-infra>=0.66,<0.73
|
|
9
9
|
Requires-Dist: httpx>=0.27
|
|
10
10
|
Requires-Dist: mutagen>=1.48.1
|
|
11
11
|
Requires-Dist: numpy>=2.0,<2.5
|
|
12
|
-
Requires-Dist: onnxruntime>=1.31,<1.32
|
|
12
|
+
Requires-Dist: onnxruntime>=1.31,<1.32 ; platform_machine != 'x86_64' or sys_platform != 'linux'
|
|
13
13
|
Requires-Dist: pillow>=10
|
|
14
14
|
Requires-Dist: pydantic>=2
|
|
15
15
|
Requires-Dist: pypng>=0.20220715.0
|
|
@@ -4,7 +4,7 @@ build-backend = "maturin"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "curu-caption"
|
|
7
|
-
version = "3.
|
|
7
|
+
version = "3.5.0"
|
|
8
8
|
readme = "README.md"
|
|
9
9
|
license = "MIT"
|
|
10
10
|
license-files = ["LICENSE"]
|
|
@@ -16,7 +16,10 @@ dependencies = [
|
|
|
16
16
|
# deliberate style step (issue #205), whose form the prompt fingerprint
|
|
17
17
|
# and the fact provenance name. 0.3.4 fixes the caller-claim-plus-form
|
|
18
18
|
# flow in avdm assemble (#12).
|
|
19
|
-
|
|
19
|
+
# avdm 0.4.0 is the floor with curu-vision 0.37.0, which requires it: its
|
|
20
|
+
# caption form is captions-6, so every `visual` fact goes stale again
|
|
21
|
+
# (issue #213), and `cut --caption` makes them again. There is no migration.
|
|
22
|
+
"avdm>=0.4.0,<0.5",
|
|
20
23
|
# The speech, WD14, search-index, d1-3B question and sound models (#115, #163,
|
|
21
24
|
# #196, #185, ADR-097). A core dependency, because a fact's provenance names its pinned
|
|
22
25
|
# model before any media is loaded. Pinned below the next minor release
|
|
@@ -27,10 +30,11 @@ dependencies = [
|
|
|
27
30
|
# 0.33.0 (the sync port, the 1 MP face tracker and `measured_threshold()`,
|
|
28
31
|
# issue #205) is the floor; 0.35.1 (the face entry keyed to `face-track-2`
|
|
29
32
|
# at the 1 MP bound, curu-vision#164) is the floor of the face gate, and
|
|
30
|
-
# 0.
|
|
31
|
-
#
|
|
32
|
-
# curu-vision
|
|
33
|
-
|
|
33
|
+
# 0.37.0 (the moss-3 token rule and the truncated transcript, curu-vision#175;
|
|
34
|
+
# the GPU-only onnxruntime with preloaded libraries on Linux x86_64,
|
|
35
|
+
# curu-vision#173) is the floor. The range is one minor, as curu-vision's
|
|
36
|
+
# ports move together.
|
|
37
|
+
"curu-vision[gpu]>=0.37.0,<0.38",
|
|
34
38
|
"av>=17",
|
|
35
39
|
"click>=8",
|
|
36
40
|
# The sister capability, not a vendored copy of one. Captioning is the only
|
|
@@ -45,7 +49,11 @@ dependencies = [
|
|
|
45
49
|
"numpy>=2.0,<2.5",
|
|
46
50
|
# curu-vision runs WD14 and the transcription on it (#163, #115); the WD14
|
|
47
51
|
# adapter also asks it for the providers. The range is curu-vision 0.13.0's.
|
|
48
|
-
|
|
52
|
+
# Off Linux x86_64: curu-vision PR #176 (fixing #173) puts the GPU-only
|
|
53
|
+
# build there and preloads its libraries, so the CPU build must not come
|
|
54
|
+
# back through this line (issue #220). It stays on darwin and windows,
|
|
55
|
+
# where curu-vision wants it.
|
|
56
|
+
"onnxruntime>=1.31,<1.32; sys_platform != 'linux' or platform_machine != 'x86_64'",
|
|
49
57
|
"pillow>=10",
|
|
50
58
|
# The VLM answers are validated as pydantic models (Caption, Verdict). Each
|
|
51
59
|
# request goes through curu-vision's vlm port, so pydantic-ai is gone (#183).
|
|
@@ -1680,10 +1680,14 @@ def _timeline_builder(
|
|
|
1680
1680
|
records.extend(run(clip_path, row))
|
|
1681
1681
|
except Exception as exc: # noqa: BLE001 -- named below, never silent
|
|
1682
1682
|
failures.append(f"{kind}: {exc}")
|
|
1683
|
-
if failures:
|
|
1683
|
+
if failures and not records:
|
|
1684
1684
|
from curu_caption.corpus.extractors import ExtractionError
|
|
1685
1685
|
|
|
1686
1686
|
raise ExtractionError(f"{clip_path.name}: timeline kinds failed: {'; '.join(failures)}")
|
|
1687
|
+
if failures:
|
|
1688
|
+
from curu_caption.corpus.timeline import PartialTimeline
|
|
1689
|
+
|
|
1690
|
+
raise PartialTimeline(records, failures)
|
|
1687
1691
|
return records
|
|
1688
1692
|
|
|
1689
1693
|
return build
|
|
@@ -63,7 +63,7 @@ from curu_caption.meta import read_meta, write_meta
|
|
|
63
63
|
if TYPE_CHECKING:
|
|
64
64
|
from curu_caption.corpus.timeline import TimelineRecord
|
|
65
65
|
|
|
66
|
-
from curu_caption.corpus.timeline import write_records
|
|
66
|
+
from curu_caption.corpus.timeline import PartialTimeline, write_records
|
|
67
67
|
|
|
68
68
|
ITEMS = "items.jsonl"
|
|
69
69
|
FACTS = "facts.jsonl"
|
|
@@ -322,11 +322,18 @@ def add_timelines(
|
|
|
322
322
|
continue
|
|
323
323
|
try:
|
|
324
324
|
records = timeline(out / MEDIA_DIR / row["path"], row)
|
|
325
|
-
|
|
325
|
+
except PartialTimeline as exc:
|
|
326
|
+
# One dead kind must not lose the kinds that worked (#213): the
|
|
327
|
+
# records land in the file, and the losses get named.
|
|
328
|
+
write_records(out / TIMELINES / f"{row['id']}.jsonl", exc.records)
|
|
326
329
|
result.timeline_written += 1
|
|
330
|
+
result.timeline_failed.append((row["id"], str(exc)))
|
|
331
|
+
continue
|
|
327
332
|
except Exception as exc: # noqa: BLE001 -- one bad clip, not one bad run
|
|
328
333
|
result.timeline_failed.append((row["id"], str(exc)))
|
|
329
334
|
continue
|
|
335
|
+
write_records(out / TIMELINES / f"{row['id']}.jsonl", records)
|
|
336
|
+
result.timeline_written += 1
|
|
330
337
|
|
|
331
338
|
for row in rows:
|
|
332
339
|
if _copy_problem(row, copied):
|
|
@@ -382,8 +389,8 @@ def _write_retrofit_readme(out: Path, source: Path, result: RetrofitResult) -> N
|
|
|
382
389
|
problems = "\n".join(f"| {line} |" for line in result.problems)
|
|
383
390
|
problems_section = f"\n## Problems\n\n| problem |\n|---|\n{problems}\n" if problems else ""
|
|
384
391
|
failed_section = (
|
|
385
|
-
f"\n##
|
|
386
|
-
f"
|
|
392
|
+
f"\n## Timeline failures\n\nA failed kind is named with its clip, and the "
|
|
393
|
+
f"records the other kinds made stay in the file.\n\n| id | why |\n|---|---|\n{failed}\n"
|
|
387
394
|
if failed
|
|
388
395
|
else ""
|
|
389
396
|
)
|
|
@@ -510,11 +517,16 @@ def write_bundle(
|
|
|
510
517
|
clip = out / CLIPS / f"{row['id']}.mp4"
|
|
511
518
|
try:
|
|
512
519
|
records = timeline(clip, row)
|
|
513
|
-
|
|
520
|
+
except PartialTimeline as exc:
|
|
521
|
+
write_records(out / TIMELINES / f"{row['id']}.jsonl", exc.records)
|
|
514
522
|
result.timeline_written += 1
|
|
523
|
+
result.timeline_failed.append((row["id"], str(exc)))
|
|
524
|
+
continue
|
|
515
525
|
except Exception as exc: # noqa: BLE001 -- one bad clip, not one bad run
|
|
516
526
|
result.timeline_failed.append((row["id"], str(exc)))
|
|
517
527
|
continue
|
|
528
|
+
write_records(out / TIMELINES / f"{row['id']}.jsonl", records)
|
|
529
|
+
result.timeline_written += 1
|
|
518
530
|
|
|
519
531
|
_write_jsonl(out / ITEMS, rows)
|
|
520
532
|
_write_jsonl(out / FACTS, [_facts_row(out, row) for row in rows])
|
|
@@ -730,8 +742,9 @@ def _write_readme(
|
|
|
730
742
|
f"| `{item_id}` | {why} |" for item_id, why in result.timeline_failed
|
|
731
743
|
)
|
|
732
744
|
timeline_failed_section = (
|
|
733
|
-
f"\n##
|
|
734
|
-
f"
|
|
745
|
+
f"\n## Timeline failures\n\nA failed kind is named with its clip, and "
|
|
746
|
+
f"the records\n the other kinds made stay in the file.\n\n"
|
|
747
|
+
f"| id | why |\n|---|---|\n{timeline_failed}\n"
|
|
735
748
|
if timeline_failed
|
|
736
749
|
else ""
|
|
737
750
|
)
|
|
@@ -225,3 +225,19 @@ def write_records(path: Path, records: Sequence[TimelineRecord]) -> None:
|
|
|
225
225
|
for record in records
|
|
226
226
|
]
|
|
227
227
|
write_text_atomic(path, "".join(lines))
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
class PartialTimeline(Exception):
|
|
231
|
+
"""Some kinds of a clip's timeline failed, and some records were made.
|
|
232
|
+
|
|
233
|
+
`records` is what the kinds that worked produced; `failures` names each
|
|
234
|
+
failed kind with its reason. The bundle writes the records and names the
|
|
235
|
+
clip under its timeline failures, so one dead kind -- SAM 3 on an odd clip,
|
|
236
|
+
MOSS on a two-second one -- does not lose the sync records of the same clip
|
|
237
|
+
(amoral's GPU run, issue #213).
|
|
238
|
+
"""
|
|
239
|
+
|
|
240
|
+
def __init__(self, records: Sequence[TimelineRecord], failures: Sequence[str]) -> None:
|
|
241
|
+
super().__init__("; ".join(failures))
|
|
242
|
+
self.records = list(records)
|
|
243
|
+
self.failures = list(failures)
|
|
@@ -356,10 +356,19 @@ class SpeakerLinkExtractor:
|
|
|
356
356
|
def extract(self, media: Path, tracks: Any) -> list[TimelineRecord]:
|
|
357
357
|
samples = _samples_for(self.kind, self._audio_loader, media)
|
|
358
358
|
try:
|
|
359
|
+
transcript = self._transcript(samples)
|
|
360
|
+
# A transcript the token rule cut can lack words, so it must not
|
|
361
|
+
# reach the link as if it were full (amoral, #213): the kind fails
|
|
362
|
+
# with the truncation, named.
|
|
363
|
+
if transcript.truncated:
|
|
364
|
+
raise ExtractionError(
|
|
365
|
+
f"{media.name}: the MOSS transcript is truncated; the "
|
|
366
|
+
f"speaker-face kind needs a full transcript (curu-vision#175)"
|
|
367
|
+
)
|
|
359
368
|
result = self._linker(
|
|
360
369
|
VideoSource(path=str(media)),
|
|
361
370
|
Audio(np.asarray(samples, dtype=np.float32), _AUDIO_SR),
|
|
362
|
-
|
|
371
|
+
transcript,
|
|
363
372
|
tracks,
|
|
364
373
|
sync=self._sync,
|
|
365
374
|
)
|
|
@@ -26,6 +26,7 @@ claim type (amoral ADR-041).
|
|
|
26
26
|
|
|
27
27
|
from __future__ import annotations
|
|
28
28
|
|
|
29
|
+
import copy
|
|
29
30
|
from collections.abc import Callable, Sequence
|
|
30
31
|
from pathlib import Path
|
|
31
32
|
from typing import Any, Final, cast
|
|
@@ -42,6 +43,7 @@ from curu_vision.entities.port import (
|
|
|
42
43
|
Tracks,
|
|
43
44
|
)
|
|
44
45
|
from curu_vision.entities.select import MEASURED, measured_threshold
|
|
46
|
+
from curu_vision.media import Frames
|
|
45
47
|
from curu_vision.media.port import Media, VideoSource
|
|
46
48
|
from curu_vision.precision import Kind
|
|
47
49
|
|
|
@@ -228,7 +230,12 @@ class PersonTrackExtractor:
|
|
|
228
230
|
|
|
229
231
|
The extractor takes the loaded `PersonTracker` from curu-vision's
|
|
230
232
|
`load_person_tracker()` and a `Media`. It reads the clip's frames at
|
|
231
|
-
*rate* (25 by default) and hands them to the tracker
|
|
233
|
+
*rate* (25 by default) and hands them to the tracker one shot at a time,
|
|
234
|
+
because a `Tracks` is the persons of one shot (curu-vision's rule), so a
|
|
235
|
+
cut inside the clip must not become one person's track. A frame time the
|
|
236
|
+
media port repeats or steps back on is dropped, so the frames each shot
|
|
237
|
+
sees stay strictly increasing (amoral's GPU run, #213). Each record names
|
|
238
|
+
its shot, so a track id of one shot cannot be read as another's.
|
|
232
239
|
"""
|
|
233
240
|
|
|
234
241
|
kind = "sam3-track"
|
|
@@ -254,31 +261,77 @@ class PersonTrackExtractor:
|
|
|
254
261
|
producer=_PERSON_PRODUCER, params=_pin(result.provenance, _PERSON_PRODUCER)
|
|
255
262
|
)
|
|
256
263
|
|
|
264
|
+
def _shot_spans(self, source: VideoSource, frames: Frames) -> list[tuple[int, list | None]]:
|
|
265
|
+
"""The frames, one strictly increasing span per shot of the clip.
|
|
266
|
+
|
|
267
|
+
The shots come from the media port; when it does not give them, the
|
|
268
|
+
whole clip is one span. Repeats and steps back are dropped. A frames
|
|
269
|
+
object without a `frames` list (a test stand-in) passes through as one
|
|
270
|
+
span, unfiltered: the tracker gets what the loader gave.
|
|
271
|
+
"""
|
|
272
|
+
span_list = getattr(frames, "frames", None)
|
|
273
|
+
if span_list is None or not hasattr(span_list, "__len__"):
|
|
274
|
+
return [(0, None)]
|
|
275
|
+
try:
|
|
276
|
+
shots = self._media.shots(source)
|
|
277
|
+
bounds = [(shot.index, shot.start, shot.end) for shot in shots.shots]
|
|
278
|
+
except Exception: # noqa: BLE001 -- no shot list: one span, still ordered
|
|
279
|
+
bounds = [(0, -1.0, float("inf"))]
|
|
280
|
+
spans: list[tuple[int, list | None]] = []
|
|
281
|
+
for index, start, end in bounds:
|
|
282
|
+
seen: float = -1.0
|
|
283
|
+
keep: list = []
|
|
284
|
+
for frame in span_list:
|
|
285
|
+
if not (start <= frame[0] < end):
|
|
286
|
+
continue
|
|
287
|
+
if frame[0] <= seen:
|
|
288
|
+
continue
|
|
289
|
+
seen = frame[0]
|
|
290
|
+
keep.append(frame)
|
|
291
|
+
if keep:
|
|
292
|
+
spans.append((index, keep))
|
|
293
|
+
return spans
|
|
294
|
+
|
|
257
295
|
def extract(self, media_path: Path) -> list[TimelineRecord]:
|
|
258
296
|
source = VideoSource(path=media_path)
|
|
297
|
+
records: list[TimelineRecord] = []
|
|
259
298
|
try:
|
|
260
299
|
frames = self._frames(self._media, source, self._rate)
|
|
261
|
-
result = self._tracker.track(frames)
|
|
262
300
|
except Exception as exc: # noqa: BLE001 -- one bad file, not one bad run
|
|
263
301
|
raise ExtractionError(
|
|
264
302
|
f"{media_path.name}: the person tracker failed: {describe(exc)}"
|
|
265
303
|
) from exc
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
304
|
+
for shot_index, span in self._shot_spans(source, frames):
|
|
305
|
+
try:
|
|
306
|
+
if span is None:
|
|
307
|
+
result = self._tracker.track(frames)
|
|
308
|
+
else:
|
|
309
|
+
subset = copy.copy(frames)
|
|
310
|
+
object.__setattr__(subset, "frames", tuple(span))
|
|
311
|
+
result = self._tracker.track(subset)
|
|
312
|
+
except Exception as exc: # noqa: BLE001 -- one bad span, not one bad run
|
|
313
|
+
raise ExtractionError(
|
|
314
|
+
f"{media_path.name}: the person tracker failed: {describe(exc)}"
|
|
315
|
+
) from exc
|
|
316
|
+
gate = _gate("person", result.provenance, self._measured)
|
|
317
|
+
for frame in result.frames:
|
|
318
|
+
for mask in frame.masks:
|
|
319
|
+
records.append(
|
|
320
|
+
TimelineRecord(
|
|
321
|
+
id=media_path.stem,
|
|
322
|
+
type="sam3-track",
|
|
323
|
+
start_s=frame.time,
|
|
324
|
+
end_s=frame.time,
|
|
325
|
+
value={
|
|
326
|
+
"track_id": mask.track_id,
|
|
327
|
+
"shot": shot_index,
|
|
328
|
+
"box": _box(mask.box),
|
|
329
|
+
},
|
|
330
|
+
confidence=mask.score,
|
|
331
|
+
producer=_pin(result.provenance, _PERSON_PRODUCER),
|
|
332
|
+
gate=gate,
|
|
333
|
+
)
|
|
280
334
|
)
|
|
281
|
-
)
|
|
282
335
|
return records
|
|
283
336
|
|
|
284
337
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|