Summary
The PyTorch video-analysis pipeline currently hand-computes frame-key padding
widths in multiple places and stores per-frame outputs under string keys such as
frame0, frame09, or frame00042.
This works, but it is a low-level serialization detail that is easy to get
wrong, e.g. see #3485 where where log10(0) for empty frames raised an
OverflowError.
Motivation
- Frame-key formatting is an implementation detail, but callers currently need
to reason about key_str_width.
- Width calculations are subtle because they depend on the highest frame index,
not just the total number of frames in an intuitive way.
- Read/write code should ideally share one canonical frame-key formatter.
Design Goals
- Centralize all frame-key logic in one place.
- Preserve the existing on-disk key format for backward compatibility.
- Reduce duplicate logic across pickle and shelf code paths.
Summary
The PyTorch video-analysis pipeline currently hand-computes frame-key padding
widths in multiple places and stores per-frame outputs under string keys such as
frame0,frame09, orframe00042.This works, but it is a low-level serialization detail that is easy to get
wrong, e.g. see #3485 where where
log10(0)for empty frames raised anOverflowError.Motivation
to reason about
key_str_width.not just the total number of frames in an intuitive way.
Design Goals