0
votes

I have a model with conv1d as the first layer. My data is time series data where each sample consists of 41 time steps where each time step has 4 features. I have about 1000 samples. I have specified the input shape of the conve1d layer to be (41,4) as it supposed to be. However, I keep getting the following error: Input 0 is incompatible with layer conv1d_48: expected ndim=3, found ndim=2.

I suspect that the problem is that the shape of X is (1000,) while the shape of X[0] is (41,4). Has anyone encountered this problem? Thanks.

l1=Input(shape=(41,4))
x=Conv1D(64,(4))(l1)
x=GlobalMaxPooling1D()(x)
x=Dense(1)(x)
model=Model(l1,x)
model.compile('rmsprop','binary_crossentropy',metrics=['acc'])
model.fit(X,y,32,10)
1
Do this: l1 = Input(shape=(41, 4))Vlad
I think it is the batch size, try Input(shape=(None,41,4))Ha Bom
@HaBom Doesn't work...Daniel Nahmias
you should reshape the X to exactly (1000,41,4)Ha Bom

1 Answers

0
votes

You defined an expected input on your Conv1D to be be 2D -> (41, 4)
But you give to it an input of shape (41,), be consistant in your definitions !

If you specify the input_shape in your Conv1D layer, you don't need to feed an Input layer to it.
Or you can change the shape of this Input layer to be consistant with this input_shape.