Custom DataLoader for Videos

I have a video dataset, it consists of 850 videos and per video a lot of frames (not necessarily same number in all frames).
As I can’t fit my entire video in GPU at once I have to sample frames from the video (maybe consecutive maybe random)

When I am building torch.utils.data.Dataset object then _ _len _ _ of the dataset should be 850 only (number of videos). Otherwise I could make it something based on number of frames as well. For example if I use 32 consecutive frames I can get length number of 32 frame videos from consecutive frames in all videos.

Then I will need to make the _ _get _ _ function based on that!

Hey,

It might be good to have a look at https://github.com/NVIDIA/nvvl
They have a PyTorch dataloader that loads videos on the GPU, and might be helpful for you.

Hi thanks @fmassa , actually I already knew about the dataloader, but actually I am under hard deadline and dont have time to install and learn new dataLoader (would probably sometime though).
Also using the former approach (len as number of videos) and closing this on that behalf
Thanks!

Also, i tried their dataloader and after struggling with their code for 3 days I gave up because it was not easy to figure.

Does pytorch have any plane to provide something for it, or at least an example should be useful

@Naman-ntc did you finally figure it out?

Did you look at there example code for superresolution in pytorch, it should help you somewhat. I looked at it in between but didn’t proceed with it.
Agree that it is somewhat complicated, but you might open an issue in case you don’t understand something!
Would be helpful to have more examples I guess!

yeah, i could not make that work on my case,
and the sad side is that i dont know how to use docker, and dont wanna get into more confusion.
Thanks anyways

I am in your shoes now, is there any hope pytorch provides a Dataloader similar to nvvl but doesn’t require all this hussle to use it.

Late, but this repository right here offers exactly what this thread is asking for: off-the-shelf PyTorch Video Dataset Loading https://github.com/RaivoKoot/Video-Dataset-Loading-Pytorch
It allows you to choose how many frames from a video you want to load and loads them evenly spaced from start to end of a video. Its native pytorch and doesn’t take the hassle that other methods do.