MCPcopy Create free account
hub / github.com/dcharatan/flowmap / FrameSampler

Class FrameSampler

flowmap/frame_sampler/frame_sampler.py:11–29  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

9
10
11class 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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected