title: Image sequence processing ConvLSTM vs LSTM architecture in Keras
body: <p>I need to train a sequence based segmentation of 10x10 images. Following are the lstm and convlstm models that I want to use:</p>
  
  <pre><code>def lstmModel():
      # Model definition
      model = Sequential()
      model.add(LSTM(50, batch_input_shape=(1, None, inp.shape[1]*inp.shape[2]), return_sequences=True, stateful=True))
      model.add(Dense(out.shape[1]*out.shape[2], activation='softmax'))
      model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy'])
      model.summary()
      return model
  
  
  def convlstmModel():
      # Model definition
      model = Sequential()
      model.add(ConvLSTM2D(12, kernel_size=5, padding = "same", batch_input_shape=(1, None, inp.shape[1], inp.shape[2], 1), return_sequences=True, stateful=True))
      model.add(Conv2D(20, 3, padding='same', activation='softmax'))
      model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy'])
      model.summary()
      return model
  </code></pre>
  
  <p>I train the models for sequence of 10 random 10x10 image sequences. LSTM model seems to work fine for me, but ConvLSTM model shows dimension mismatch for the Conv2D layer:</p>
  
  <pre><code>ValueError: Input 0 is incompatible with layer conv2d_1: expected ndim=4, found ndim=5
  </code></pre>
  
  <p>Any help is really appreciated. Thanks!</p>