DVPApplied Creative AI Engineering

Search this course

Search lesson and reference material.

↑ ↓ to choose · Enter to open · Esc to close

Milestone 7 of 12

Dataset, labels, splits, and leakage

Design a benchmark that earns trust.

Leakage-safe benchmark
lawful sourcegrouped splitdataset card
Labeled clips remain grouped by source as they enter protected dataset partitions.
7 hoursPhase 3 · Learned detectionRelease 3 · available
Learning objectives
Entry diagnostic

Identify a leakage route in a proposed split and correct it.

Build the benchmark before the model. Required route: task and ontology (70 min), agreement and grouping (70 min), split clinic (80 min), dataset build (100 min), failure clinic (40 min), transfer/evidence (60 min). Total: 7 hours, including the selected reading.

Entry diagnostic

A hundred clips become ten thousand frames. A random frame split scores 98%. Identify the likely leakage route and name the grouping key that repairs it.

Self-check

Which question must be answered before choosing labels: clip classification, frame localization, or a temporal score?

Why this matters in CineQC

A detector inherits its dataset's boundaries. CineQC needs labels tied to visible evidence, source-aware splits, and provenance that permits lawful use. A high score cannot repair private-media exposure, duplicate leakage, or an ambiguous ontology.

Visual model — source to frozen benchmark

A split diagram contrasts clip-a leakage across train and test with source-grouped partitions.

A split diagram contrasts clip-a leakage across train and test with source-grouped partitions.
Static explanation. The same relationship becomes learner-controlled when JavaScript is available; the lesson remains complete without it.

Use lawful source → sequence group → anchored label → frozen split → dataset card. Define one primary task: classify a short sequence as clean, flicker, stutter, color_drift, sharpness_collapse, or motion_incoherence. Frame localization and continuous temporal scoring are useful extensions, but are optional here.

A label ontology names each class, inclusion/exclusion rules, boundary cases, and anchored examples. An anchor pairs a short lawful sequence description with the reason for its label. Keep intentional cuts, flashes, holds, focus pulls, and camera moves as explicit clean or review examples so the model is not taught that cinema is a defect.

Measure agreement on a double-labelled subset. Report raw agreement and per-class disagreements; Cohen's kappa may supplement, never replace, the disagreement review. Resolve the guide—not merely the labels—when annotators interpret the same case differently.

Group first, then split

Assign every item a stable source_id and sequence_id. All frames, crops, encodes, and augmented variants derived from one sequence stay in one split. Source grouping is stricter when one master yields several edits. The roles are distinct:

Deduplicate before splitting using provenance plus content fingerprints. Handle imbalance with documented sampling or loss weights measured on training data. Apply spatial or photometric augmentation only when it preserves the label; never create validation/test variants or let a synthetic defect cross splits.

Runtime: Local Python 3.12 · standard library · 20 min.

from collections import defaultdict

records = [
    {"item": "a-001", "source_id": "master-a", "sequence_id": "clip-a", "label": "clean"},
    {"item": "a-002", "source_id": "master-a", "sequence_id": "clip-a", "label": "flicker"},
    {"item": "b-001", "source_id": "master-b", "sequence_id": "clip-b", "label": "clean"},
]
split_for_source = {"master-a": "train", "master-b": "test"}
groups = defaultdict(set)
for row in records:
    groups[row["source_id"]].add(split_for_source[row["source_id"]])
assert all(len(splits) == 1 for splits in groups.values())
print({row["item"]: split_for_source[row["source_id"]] for row in records})

Self-check

Why is augmenting first and randomly splitting later unsafe even when filenames differ?

Sandbox lab

Create dataset-v1.jsonl from a small public or generated fixture. Validate required fields: item ID, source and sequence groups, label, time range, provenance, license, consent/privacy note, checksum, and split. Freeze the manifest and its checksum before training. Produce a count table by label and split and an automated assertion that no source, sequence, or exact duplicate crosses splits.

Failure clinic — same clip split

The failure: adjacent frames 100–149 from one clip land in train while frames 150–199 land in test. Compression texture, camera, set, and neighboring motion make them near-duplicates. The model recognizes the clip rather than the artifact.

Repair it by grouping every derived frame and window by the parent sequence before the split. If multiple sequences share one master, performer, template, or generation prompt, decide whether the intended generalization requires grouping at that source level too. Re-run duplicate checks after every ingest.

Other failures include changing the ontology after inspecting test errors, treating missing provenance as public permission, allowing aggressive augmentation to erase the defect, and hiding minority-class failures behind accuracy. Preserve lawful licensing and privacy constraints; do not place private CineQC media, paths, thumbnails, or metadata in the public artifact.

CineQC transfer

Map each learned label to the closest deterministic signal and list non-equivalences. A heuristic threshold is not a ground-truth label. Export only sanitized IDs and aggregate counts from private evaluation. Keep a public fixture sufficiently small to reproduce the dataset checks without revealing proprietary media.

Self-check

What makes dataset v1 genuinely frozen: a filename, or immutable records plus hashes, split assignments, label-guide version, and provenance?

Evidence gate

Submit frozen dataset v1, its label guide, and dataset card. Evidence must include:

  1. a primary task and six-class ontology with anchored positive, negative, and boundary examples;
  2. an agreement sample and documented resolutions;
  3. source/sequence-aware train, validation, and fixed test splits with duplicate checks;
  4. train-only augmentation and imbalance policy;
  5. manifest checksum, provenance, lawful licensing, and privacy decisions;
  6. a public fixture and explicit public/private boundary—never private CineQC media.

One-page summary

Required resource
paper
Datasheets for Datasets
Use the documentation questions to make dataset provenance, composition, and limitations explicit. · 35 min
Go deeper
docs
scikit-learn grouped cross-validation
Inspect grouped splitting patterns after implementing the simpler fixed source split. · 15 min
Evidence gate

Frozen dataset v1 plus label guide and dataset card.

Diagnostic route

Check the statements you can demonstrate in the challenge. Selections route your learning; they are not proof of mastery.

What can you demonstrate?

Start the full milestone.

Evidence gate

Submit an inspectable artifact for independent review. Only a verified diagnostic challenge or reviewed evidence can mark this milestone proven. Proof is local self-tracking, not tamper-resistant against edits to this browser storage.

Local mastery progress

Current state: not-started. Advance through learning, practice, and submitted evidence; proof requires a later passed review.

Notes

Your local study notes mount here when JavaScript is available.

Protected AI Tutor

Teaching modes mount here when JavaScript is available. The readable course remains available without them.