title: Using LSTM after CNN / Convolutional LSTM in keras
body: <p>I want to predict numerical Y variable using time-series image data. 
  My dataset has these dimensions: </p>
  
  <ul>
  <li>X: (7000, 3, 128, 128)</li>
  <li>Y: (7000, 1)</li>
  </ul>
  
  <p>7000 is the number of samples, each sample is 128 x 128 image and 3 is the number of channels (RGB). The range of the Y variable is 0-1. </p>
  
  <p>Therefore, I want to apply an LSTM model after a CNN. But if I feed the CNN features to LSTM, so many errors occurs. Please help me.</p>
  
  <p>This is my code:</p>
  
  <pre><code>size = 128
  model = Sequential()
  
  model.add(Convolution2D(32, (3, 3), input_shape=(3, size, size)))
  model.add(Activation('relu'))
  model.add(Convolution2D(32, (3, 3)))
  model.add(Activation('relu'))
  model.add(MaxPooling2D(pool_size=(2, 2)))
  model.add(Dropout(0.25))
  
  model.add(Convolution2D(64, (3, 3)))
  model.add(Activation('relu'))
  model.add(Convolution2D(64, (3, 3)))
  model.add(Activation('relu'))
  model.add(MaxPooling2D(pool_size=(2, 2)))
  model.add(Dropout(0.25))
  
  
  #### LSTM #####
  model.add(LSTM(50)) ???????????????????????????
  
  model.add(Flatten())
  model.add(Dense(32))
  model.add(Activation('relu'))
  model.add(Dropout(0.5))
  
  model.add(Dense(1))
  model.add(Activation('sigmoid'))
  
  model.compile(loss='mse', optimizer= 'adam')
  return model
  </code></pre>