Skip to content Skip to sidebar Skip to footer

Keras: Input_shape=train_data.shape Produces "list Index Out Of Range"

I want to use Keras to build a CNN-LSTM network. However, I have trouble finding the right shape for the first layer's input_shape parameter. My train_data is a ndarray of the sha

Solution 1:

When using a TimeDistributed layer combined with a Conv2D layer, it seems that input_shape requires a tuple of length 4 at least: input_shape = (number_of_timesteps, height, width, number_of_channels).

You could try to modify your code like this for example:

model = Sequential()
model.add(TimeDistributed(Conv2D(
      CONV_FILTER_SIZE[0],
      CONV_KERNEL_SIZE,
      activation="relu",
      padding="same"),
    input_shape=(None, 32, 32, 1))

More info here.

Post a Comment for "Keras: Input_shape=train_data.shape Produces "list Index Out Of Range""