ValueError: Input 0 of layer sequential is incompatible with the layer: expected ndim=3, found ndim=4. Full shape received: [None, 25, 25, 1]

datascience.stackexchange https://datascience.stackexchange.com/questions/85608

  •  16-12-2020
  •  | 
  •  

Question

I am trying to use conv1D but getting that error. My dataset's is batched and has a shape of [None, 25, 25, 1] I am using input_shape=(25,25) I am not able to figure out what should I change so I can get it to work.

My model:

model = Sequential()
model.add(Conv1D(32, kernel_size=3, activation='relu', input_shape=(25,25))
model.add(Flatten())
model.add(Dense(1, activation='sigmoid'))
Was it helpful?

Solution

I have solved the problem by changing the shape of my dataset using:

tf.reshape(data, [25, 25])
Licensed under: CC-BY-SA with attribution
Not affiliated with datascience.stackexchange
scroll top