pytorch / torchcodec

PyTorch video decoding
BSD 3-Clause "New" or "Revised" License
77 stars 9 forks source link

Add Random time-based sampler #255

Closed NicolasHug closed 3 weeks ago

NicolasHug commented 4 weeks ago

This PR adds a random time-based sampler, and also updates our benchmark.

It must take a num_clips parameter instead of seconds_between_clip_starts like in clips_at_regular_timestamps().

This means the _generic_time_based_sampler takes both num_clips and seconds_between_clip_starts as parameter, and they're mutually exclusive. That is not user-facing.

The _implem.py file is growing large. When this PR is merged, I think it'll be time to re-organize and split the implementation in different files. Typically the policies could be kept separate.

NicolasHug commented 3 weeks ago

Test on Linux CUDA is red but it looks like it's an unrelated infra issue, I'll merge. Thanks for the review!