Video frame classificaion with a few long videos

PCPJ: <p>I am trying to train a RNN to make a binary classification on the frames of a video stream.<br>
I already tested a RNN model with the Jester dataset, now I want to train my model with my dataset.<br>
My question is how to prepare my dataset, since it is made of 10 videos, each one with a length of 10 minutes, in average.</p>
<p>My first (and probably naive) idea was to batch each frame following the order in the video, but I know that it is important to shuffle your dataset when training. So I discarded this idea.</p>
<p>Any other suggestion?<br>
Thank you.</p>

floriandonhauser: <p>For splitting the data into train, validation and test sets, you have to make sure that the test set does not include e.g. some seconds before and some seconds after a test sample since then the model might not actually generalize to entirely new videos. In general, it might make sense to use the beginning for training, the middle for validation and the end for testing.<br>
Inside the three datasets you will create individual training examples.<br>
Those training examples you can likely shuffle.<br>
You could e.g. read through this blog post:<br>
<a href="https://medium.com/smileinnovation/training-neural-network-with-image-sequence-an-example-with-video-as-input-c3407f7a0b0f" rel="noopener nofollow ugc">https://medium.com/smileinnovation/training-neural-network-with-image-sequence-an-example-with-video-as-input-c3407f7a0b0f</a></p>

PCPJ: <p>Thanks for the response, <a class="mention" href="/u/floriandonhauser">@floriandonhauser</a> !<br>
About these individual training samples, following some ideas on the blog spot you mentioned.<br>
If I take a video with a duration of 600 seconds (10 minutes), extract samples of 3 seconds, with a stride of 1 second, the number of samples will be:</p>
<pre><code class="lang-auto">10*60 -(3 -1) = 596
</code></pre>
<p>Since I have 10 videos, I will have 596*10 samples. If I decrease the stride to half a second I approximately double this amount. It sound a good amount for me, especially knowing that maybe I can get some new videos in the future.</p>
<p>But I have one question about this. When this model gets deployed, it will run on a video stream that can be hours long. If I train on small samples (3 seconds), how will the recurrent cells (LSTM cells) learn to keep long term information on memory?</p>
<p>I will try to train the network with these ideas you presented, already helped me a lot!<br>
Thank you very much.</p>

floriandonhauser: <p>First, I am no expert in  using LSTM cells for video data.<br>
As far as I understand, LSTMs are not perfect at keeping information over many invocations.<br>
However, the question is, whether this is even necessary.<br>
If you want to classify the current situation of your video stream, is history of e.g. more than 2 minutes ago really important? That entirely depends on the video data you are using.<br>
Think about the kind of data and you goal and how much history the model needs to keep.</p>

PCPJ: <p>I don’t know for sure, but I think that a few minutes of history is enough.<br>
But any way, can a network trained only with samples of a few seconds, learn how to keep the hitorory of a couple minutes?</p>