Temporal Grounding
Finding when something happened matters as much as what. Temporal grounding maps language to timestamps: the exact seconds where the query lives in the video.
Why Does This Exist?
Hours of footage hold seconds of interest: the goal in the match, the defect on the line, the moment the suspect appears. Scrubbing wastes expert hours; whole-video classifiers answer "yes it happened" without saying when. Products need timestamps — jump links, evidence clips, alert windows — not bag-level verdicts.
Temporal grounding (moment retrieval) takes a video plus a language query and returns start-end spans. Architectures split into proposers (enumerate candidate spans, rank by query match) and span predictors (regress start/end distributions directly, QA-style). The metric is temporal IoU against human marks. The narrative home is long-form understanding; the clip classifier is action recognition.
The one idea you need first. Temporal IoU mirrors box IoU in one dimension: intersection seconds over union seconds of predicted and true spans. Recall@ at IoU asks whether the top prediction overlaps truth by at least half — the standard hit criterion. Boundary fuzz (humans disagree by seconds) motivates looser thresholds () alongside strict ones ().
Think of It Like This
Finding one quote in a podcast
Nobody re-listens to three hours for one sentence. Transcript search jumps to candidate paragraphs; surrounding context confirms the exact quote; the share link carries the timestamp. Skim, verify, cite — three moves, seconds total.
Grounding pipelines mirror the ritual. Proposals are transcript hits (candidate spans); query matching is the context read (does this span show the goal?); the span output is the timestamp link. Whole-video classification is the friend who confirms "yeah it was in there somewhere" — technically right, practically useless.
How It Actually Works
Video and query encode jointly (cross-attention between frames and words), then heads predict: start/end probability distributions over time (span style, trained with KL against Gaussian-smoothed truth boundaries) or proposal scores over sliding windows and scales. Non-maximum suppression dedupes overlapping predictions. Training softens boundaries (label smoothing around human marks) because exact frames are annotator fiction. Inference thresholds or takes top- spans per query.
Scale handling decides quality: multi-scale feature pyramids catch -second gestures and -minute procedures in one pass.
Worked example
Truth: the goal spans s. Prediction: s. Intersection: s. Union: s. IoU .
At threshold : hit (counts toward Recall@). At threshold : miss. One prediction, two verdicts — which is why papers report curves instead of single numbers, and why a "state of the art " needs its threshold attached to mean anything.
Code
The point of this snippet is the verdict: intersection over union decides hit or miss at each threshold.
def temporal_iou(pred: tuple, truth: tuple) -> float: inter = max(0.0, min(pred[1], truth[1]) - max(pred[0], truth[0])) union = max(pred[1], truth[1]) - min(pred[0], truth[0]) return inter / union # 1-D overlap ratio
iou = temporal_iou((35.0, 55.0), (30.0, 50.0))print(round(iou, 2)) # -> 0.6print(iou >= 0.5, iou >= 0.7) # -> True FalseWatch Out For
Boundaries humans never agreed on
Annotators marking "the goal" differ by seconds (run-up included or not?), so the threshold forgives what punishes arbitrarily. Models tuned to one dataset's boundary conventions transfer poorly where conventions differ.
Smooth training labels around marks and report multi-threshold curves. A model winning only at retrieves neighborhoods, not moments — fine for browsing, fatal for evidence.
Proposals biased to middles and longs
Sliding windows oversample middle-length spans in the video center; datasets overrepresent medium moments. Models learn the prior (predict central, medium spans) and score respectably while grounding nothing — the temporal version of language bias in VQA.
Debias evaluation with out-of-distribution splits (odd positions, odd lengths) and check prediction histograms against uniform. A grounding model predicting the dataset mean is a prior with extra steps.
The Quick Version
- Temporal grounding returns start-end spans for language queries over video.
- The worked fixture gives IoU : a hit at , a miss at .
- Report multi-threshold curves; single numbers without thresholds mislead.
- Smooth boundary labels during training because exact frames are annotator fiction.
- Debias with odd-position splits, or models learn to predict the dataset's middle.