title: Loading frames to 3D CNN
body: <p>I have an 3D Convolutional Neural Network in Python with TFLearn.</p>
  
  <p>Example code bellow:</p>
  
  <pre><code>def model_3d(self):
      """
      This function will build our 3D Convolutional Neural Network
      """
  
      #Layers
      net = tflearn.input_data(shape=[None, 40, 80, 80, 3], name='InputLayer')
      net = tflearn.layers.conv.conv_3d(net, 32,  filter_size=(3, 3, 3), activation='relu', name='Conv3D1')
      net = tflearn.max_pool_3d(net, kernel_size=(1, 2, 2), strides=(1, 2, 2), name='MaxPool3D1')
      net = tflearn.layers.conv.conv_3d(net, 32,   filter_size=(3, 3, 3), activation='relu', name='Conv3D2')
      net = tflearn.max_pool_3d(net, kernel_size=(2, 2, 2), strides=(2, 2, 2), name='MaxPool3D2')
      net = tflearn.layers.conv.conv_3d(net, 64,   filter_size=(3, 3, 3), activation='relu', name='Conv3D3')
      net = tflearn.max_pool_3d(net, kernel_size=(2, 2, 2), strides=(2, 2, 2), name='MaxPool3D3')
      net = tflearn.layers.conv.conv_3d(net, 128,   filter_size=(2, 2, 2), activation='relu', name='Conv3D5')
      net = tflearn.max_pool_3d(net, kernel_size=(2, 2, 2), strides=(2, 2, 2), name='MaxPool3D4')
      #FC Layers
      net = tflearn.fully_connected(net, 1024, activation='relu', name='FC1')
      net = tflearn.dropout(net, 0.5)
      net = tflearn.fully_connected(net, self.n_classes, activation='softmax', name='FC3')
      net = tflearn.regression(net, optimizer='adam', loss='categorical_crossentropy', learning_rate=1e-5)
  
      return [net]
  </code></pre>
  
  <p>I'll use this model to learn and classify video. For this i wrote an algorithm that extract 40 frames per video and generates a folder with subfolders representing each class, a new dataset, basically.</p>
  
  <p>My point is. Which is the best way to load these frames to this model?
  Should i use mini-batch method with 40 examples (frames) or in case of 3D CNN, the input layer takes 40 images at a time from the dataset and learn from it?</p>
  
  <p>I need to know how this model can learn from a set of 40 frames, once each class subfolder have 40 images per video, so, to detail, if i have 50 videos in a class, i have 50*40 frames in that folder.</p>
  
  <p>I've searched a lot to solve this specific problem but nothing until now.</p>
  
  <p>Thanks for the support and attention!</p>