How Do You Evaluate Segment-Level Video Retrieval in PyTorch?

I am designing an evaluation pipeline for video retrieval where the target is not only the correct video, but also the relevant segment inside that video.

Each evaluation sample may include:

  • Query text
  • Video ID
  • Expected start time
  • Expected end time
  • Retrieved start time
  • Retrieved end time
  • Language
  • Source platform

I am considering evaluating the system at two levels:

  1. Video-level retrieval
  2. Segment-level retrieval using temporal overlap

For PyTorch users working on video-language or retrieval models:

  • Do you keep ground-truth segments in a separate manifest?
  • Which metric do you use for temporal overlap?
  • Do you report Recall@K separately from segment-level accuracy?
  • How do you handle queries with multiple valid segments?
  • Do you batch variable-length candidate segments or evaluate them independently?
  • How do you break down results by video duration, language, or query type?

I am mainly interested in practical evaluation and Dataset/DataLoader patterns rather than model architecture.

I’m with aicost.tools, so this is more evaluation plumbing than video-ML expertise: I’d keep the ground-truth segments in their own manifest keyed by query ID, because one query often has several valid segments and that never fits neatly into a per-sample row. For overlap I’d use temporal IoU and report Recall@K at IoU 0.5 and 0.7, like most moment-retrieval benchmarks do, and keep video-level R@K as a separate number, otherwise a strong video ranker hides a weak localizer. For multi-segment queries, just take the max IoU over all ground-truth segments. How many queries per language do you have? Below a few hundred, per-language numbers get noisy fast.

I would not pad every candidate window in a long video up to the same length. Score each candidate on its own, or pack only the windows for one query and mask the padding, otherwise a two-hour source dominates eval time and a forgotten mask changes the pooled embedding. Count temporal overlap only when the right video is already inside your video-level Recall@K, so a retrieval miss is not also scored as a bad localizer. Bucket results by the ground-truth segment length rather than the full video length, or a two-second moment inside a long video gets mixed with long moments.