Preparing dataset for video analyzing

mmdbrdrn: <p>Hi every one,<br>
i’ve done several projects on deep learning based image processing (classification,…) but i am new with video processing in pytorch.<br>
I want to analyze video sequences, for example activity recognition and i have faced problems in preparing dataset for this task .<br>
I have a training set of different actions in sub folders and i want to produce a sliding window (ex: 10 sequence of frames) to feed to the model ( i want my input size to be 10<em>227</em>227). how can i do this.<br>
the frames order is important and i don’t want the frames to be got randomly!!</p>

ptrblck: <p>Have a look at <a href="https://discuss.pytorch.org/t/how-upload-sequence-of-image-on-video-classification/24865/9">this post</a>.<br>
In this topic the user was dealing with different activities performed by different persons.<br>
Using a custom sampler, you could use a sliding window approach by providing the “invalid” frame indices, where the window should not grab images from.</p>
<p>Would the code example be suitable as a starter code?</p>
<p>PS: Tagging certain people might discourage others to answer in your thread. <img src="https://discuss.pytorch.org/images/emoji/apple/wink.png?v=9" title=":wink:" class="emoji" alt=":wink:"></p>

mmdbrdrn: <p>thank you very much .<br>
i did as you recommend .<br>
I first found that post which was quite close to mine, but how about defining a dataset class?!</p>

dimaxano: <p>Do you want to feed only 10 frames from each video to the model?</p>

mmdbrdrn: <p>thank you very much for helping.</p>
<p>i have a training set composed of 13 activity subfolders for example, and each activity sub folder contains 200 frames .<br>
i want to feed my data to the model as this:</p>
<p>batch0: img0,img1,…img9<br>
batch1: img1,img2,…img10<br>
.<br>
.<br>
.<br>
batch n: img(n) , img (n+1),…imge(n+9)<br>
for each class of activities<br>
how should i define the dataset class?</p>

dimaxano: <p>Got it, thank you for explanation.<br>
I dove into this thread cause I’m working with some kind of action recognition. But in my case I’m feeding network with a whole sequence at a time. As for you, I almost sure you should look towards <a href="https://pytorch.org/docs/stable/data.html?highlight=sampler#torch.utils.data.Sampler" rel="nofollow noopener">Sampler</a>.</p>

mmdbrdrn: <p>Thank you very much for all, for your great comments and help<br>
i really appreciate it, im trying to dive into sampler to get the comments precisely and solve it</p>

lanka: <p>hi,<br>
can you please explain me to how we use <code>collate_fn</code> in dataloader. because I have 20 sentences for one image and need to select a random sentence for train decoder.</p>

raivokoot: <aside class="onebox githubfolder">
  <header class="source">
      <img src="https://github.githubassets.com/favicons/favicon.svg" class="site-icon" width="15" height="15">
      <a href="https://github.com/RaivoKoot/Video-Dataset-Loading-Pytorch" target="_blank" rel="noopener nofollow ugc">github.com</a>
  </header>
  <article class="onebox-body">
    <img src="https://avatars.githubusercontent.com/u/29647087?s=400&amp;amp;v=4" class="thumbnail onebox-full-image" width="59" height="59">

<h3><a href="https://github.com/RaivoKoot/Video-Dataset-Loading-Pytorch" target="_blank" rel="noopener nofollow ugc">RaivoKoot/Video-Dataset-Loading-Pytorch</a></h3>


  <p><span class="label1">Generic PyTorch Dataset Implementation for Loading, Preprocessing and Augmenting Video Datasets</span></p>

  </article>
  <div class="onebox-metadata">
    
    
  </div>
  <div style="clear: both"></div>
</aside>

<p>Late, but this can help to whoever still needs it.</p>