14

Or, more specific: what is the difference between ConvLSTM2D and ConvLSTM2DCell?

What is the difference between SimpleRNN and SimpleRNNCell?

Same question for GRU and GRUCell

Keras manuals are not very verbose here.

I can see from RTFS (reading those fine sources) that these classes are descendants of different base classes. Those, with names, ending with Cell, are subclasses of Layer.

In my task I need to classify video sequences. That is, my classifier's input is a sequence of video frames, and the output is a single label (one-hot encoded vector).

What class should I use?

Nicolas Gervais
  • 33,817
  • 13
  • 115
  • 143
wl2776
  • 4,099
  • 4
  • 35
  • 77

1 Answers1

15

The difference is the same for every cell layer combo:

  • Cell: The cell is the actual computation component, they take a single input, a past state and produce an output, new states. These actually perform the step function which contain the computation of a GRU cell for example.
  • RNN Layer: These layers wrap the corresponding cells to apply the same cell to multiple timesteps. So the cell is iterated over the input sequence and collect the output(s) based on extra options such as return_sequences.
nuric
  • 11,027
  • 3
  • 27
  • 42
  • In my task, I need to classify video sequences into one of several categories. That is, my input is a sequence of video frames, and output is a label, that can be, for example, a one-hot vector (I'm in process of setting my task). I should use subclasses of `Layer`, right? – wl2776 May 30 '18 at 15:34
  • 3
    Yes, you almost never use cells directly if you already have sequences. Because even though cells are subclasses of Layer they have a slightly different call signature to take into account states etc. – nuric May 30 '18 at 15:43
  • Then, it looks like, not yes, but no. I should use `ConvLSTM2D`, not `ConvLSTM2DCell`. – wl2776 May 30 '18 at 15:46
  • Yes, use the wrapping layers that actually iterate over the timesteps for you. – nuric May 30 '18 at 15:47