title: How to process input data in Keras ConvLSTM layer
body: <p>I have a grid dataset with 14512 days, grid size is 25 * 53. The prediction time is 14 days. I try to put them into Keras ConvLSTM layer, but the result seem to be incorrect. How can I process the input data?</p>
  
  <p>preprocess the data: 
  data's shape is (14512, 25, 53)</p>
  
  <pre><code>fh = Dataset('slp.nc', mode='r')
  length = len(fh.variables['time'][:])
  lat = len(fh.variables['lat'][:])
  lon = len(fh.variables['lon'][:])
  data = [[[0 for _ in range(0, lon)] for _ in range(0, lat)] for _ in range(0, length)]
  for i in range(0, length):
      item = fh.variables['slp'][i]
      for j in range(0, lat):
          for k in range(0, lon):
              data[i][j][k] = item[j][k]
  data = pd.DataFrame(data)
  data.drop([8665], inplace=True)
  </code></pre>
  
  <p>Then define the model:</p>
  
  <pre><code>model = Sequential()
  model.add(ConvLSTM2D(filters=40, kernel_size=(3, 3), input_shape=(None, 25, 53, 1), padding='same', return_sequences=True))
  model.add(BatchNormalization())
  model.add(ConvLSTM2D(filters=40, kernel_size=(3, 3), padding='same',   return_sequences=True))
  model.add(BatchNormalization())
  model.add(ConvLSTM2D(filters=40, kernel_size=(3, 3), padding='same', return_sequences=True))
  model.add(BatchNormalization())
  model.add(ConvLSTM2D(filters=40, kernel_size=(3, 3), padding='same', return_sequences=True))
  model.add(BatchNormalization())
  model.add(Conv3D(filters=1, kernel_size=(3, 3, 3), activation='sigmoid', padding='same', data_format='channels_last'))
  model.compile(loss='binary_crossentropy', optimizer='adadelta')
  </code></pre>
  
  <p>Then generate input data and train:</p>
  
  <pre><code>train_x = np.zeros((t_day, 14, 25, 53, 1),dtype = np.float)
  train_y = np.zeros((t_day, 14, 25, 53, 1),dtype = np.float)
  for i in range(t_day):
      for j in range(0, 14):
          for a in range(25):
              for b in range(53):
                  if i + j &gt; 13:
                      train_x[i][j][a][b][0] = data[i-14+j][a][b]
                  if i + j &lt; 13:
                      train_x[i][j][a][b][0] = 0
                  train_y[i][j][a][b][0] = data[i+14+j][a][b]
  model.fit(train_x, train_y, epochs=100, batch_size=128, validation_split=0.05, verbose=1, shuffle=False)
  </code></pre>
  
  <p>But the loss function seem to be incorrect:</p>
  
  <pre><code>Epoch 1/100
  
  10/11400 [..............................] - ETA: 2:56:36 - loss: -3.7733
  20/11400 [..............................] - ETA: 2:18:04 - loss: -110.7391
  30/11400 [..............................] - ETA: 2:04:56 - loss: -322.3076
  40/11400 [..............................] - ETA: 1:58:30 - loss: -554.6822
  50/11400 [..............................] - ETA: 1:54:23 - loss: -746.9508
  60/11400 [..............................] - ETA: 1:51:40 - loss: -932.8895
  70/11400 [..............................] - ETA: 1:49:53 - loss: -1141.2996
  80/11400 [..............................] - ETA: 1:48:23 - loss: -1368.9223
  90/11400 [..............................] - ETA: 1:47:08 - loss: -1579.1898
  100/11400 [..............................] - ETA: 1:46:08 - loss: -1773.8168
  110/11400 [..............................] - ETA: 1:45:18 - loss: -1990.5375
  120/11400 [..............................] - ETA: 1:44:37 - loss: -2189.3257
  130/11400 [..............................] - ETA: 1:44:01 - loss: -2364.1422
  140/11400 [..............................] - ETA: 1:43:36 - loss: -2579.9297
  150/11400 [..............................] - ETA: 1:43:05 - loss: -2818.1180
  160/11400 [..............................] - ETA: 1:42:40 - loss: -3001.0507
  170/11400 [..............................] - ETA: 1:42:17 - loss: -3173.8332
  180/11400 [..............................] - ETA: 1:41:55 - loss: -3358.1284
  190/11400 [..............................] - ETA: 1:41:38 - loss: -3541.8308
  200/11400 [..............................] - ETA: 1:41:20 - loss: -3733.1575
  210/11400 [..............................] - ETA: 1:41:09 - loss: -3941.8186
  220/11400 [..............................] - ETA: 1:40:54 - loss: -4164.8925
  230/11400 [..............................] - ETA: 1:40:41 - loss: -4422.5382
  </code></pre>