I am trying to build a CNN+RNN model for a computer vision problem. below is my code
def cnn_with_rnn(shape):
model = Sequential()
model.add(Conv2D(32, (3, 3), strides=(2, 2), activation="relu",kernel_initializer='truncated_normal',bias_initializer='truncated_normal', input_shape=shape))
model.add(MaxPool2D(pool_size=(2, 2)))
model.add(Conv2D(64, (3, 3), strides=(2, 2),kernel_initializer='truncated_normal',bias_initializer='truncated_normal', activation="relu"))
model.add(MaxPool2D(pool_size=(2, 2)))
model.add(Conv2D(128, (3, 3), strides=(2, 2),kernel_initializer='truncated_normal',bias_initializer='truncated_normal', activation="relu"))
model.add(LSTM(50))
model.add(Dense(1))
model.compile(optimizer=Adam(lr=1e-5), loss="mse", metrics=[custom_metric])
My image is a RGB image with the following shape - [66,200,3], where 3 is the number of color channels.
When i am trying to run the above code , i am getting the following error
ValueError: Input 0 is incompatible with layer lstm_3: expected ndim=3, found ndim=4
How can i combine CNN+RNN for colored images and how to solve my above problem?