title: Add LSTM layer after Conv2D layers and add some other inputs
body: <p>I'm working on a racing game that uses reinforcement learning. To train the model I'm facing an issue when implementing the neural network. I found some examples that use CNN. But it seems like adding extra LSTM layer will increase the model efficiency. I found the following example.</p>
  
  <p><a href="https://team.inria.fr/rits/files/2018/02/ICRA18_EndToEndDriving_CameraReady.pdf" rel="nofollow noreferrer">https://team.inria.fr/rits/files/2018/02/ICRA18_EndToEndDriving_CameraReady.pdf</a></p>
  
  <p><a href="https://i.stack.imgur.com/IGuVX.png" rel="nofollow noreferrer">The network I need to implement</a></p>
  
  <p>The problem is I'm not sure how can I implement the LSTM layer here. How can I give following inputs to LSTM layer</p>
  
  <ol>
  <li>Processed image output</li>
  <li>current speed</li>
  <li>last action</li>
  </ol>
  
  <p>Here is the code I'm currently using. I want to add the LSTM layer after Conv2D. </p>
  
  <pre><code>    self.__nb_actions = 28
      self.__gamma = 0.99
  
      #Define the model
      activation = 'relu'
      pic_input = Input(shape=(59,255,3))
  
      img_stack = Conv2D(16, (3, 3), name='convolution0', padding='same', activation=activation, trainable=train_conv_layers)(pic_input)
      img_stack = MaxPooling2D(pool_size=(2,2))(img_stack)
      img_stack = Conv2D(32, (3, 3), activation=activation, padding='same', name='convolution1', trainable=train_conv_layers)(img_stack)
      img_stack = MaxPooling2D(pool_size=(2, 2))(img_stack)
      img_stack = Conv2D(32, (3, 3), activation=activation, padding='same', name='convolution2', trainable=train_conv_layers)(img_stack)
      img_stack = MaxPooling2D(pool_size=(2, 2))(img_stack)
      img_stack = Flatten()(img_stack)
      img_stack = Dropout(0.2)(img_stack)
  
      img_stack = Dense(128, name='rl_dense', kernel_initializer=random_normal(stddev=0.01))(img_stack)
  
      img_stack=Dropout(0.2)(img_stack)
      output = Dense(self.__nb_actions, name='rl_output', kernel_initializer=random_normal(stddev=0.01))(img_stack)
  
      opt = Adam()
      self.__action_model = Model(inputs=[pic_input], outputs=output)
  
      self.__action_model.compile(optimizer=opt, loss='mean_squared_error')
      self.__action_model.summary()
  </code></pre>
  
  <p>Thanks</p>