A frame sampler picks the frames that should be sampled from a dataset's video. It makes sense to break the logic for frame sampling into an interface because pre-training and fine-tuning require different frame sampling strategies (generally, whole video vs. batch of video segments of s
| 9 | |
| 10 | |
| 11 | class FrameSampler(ABC, Generic[T]): |
| 12 | """A frame sampler picks the frames that should be sampled from a dataset's video. |
| 13 | It makes sense to break the logic for frame sampling into an interface because |
| 14 | pre-training and fine-tuning require different frame sampling strategies (generally, |
| 15 | whole video vs. batch of video segments of same length). |
| 16 | """ |
| 17 | |
| 18 | cfg: T |
| 19 | |
| 20 | def __init__(self, cfg: T) -> None: |
| 21 | self.cfg = cfg |
| 22 | |
| 23 | @abstractmethod |
| 24 | def sample( |
| 25 | self, |
| 26 | num_frames_in_video: int, |
| 27 | device: torch.device, |
| 28 | ) -> Int64[Tensor, " frame"]: # frame indices |
| 29 | pass |
nothing calls this directly
no outgoing calls
no test coverage detected