0

The train shape is: (985039, 8) and after reshaping is : (985039, 1, 8) My code is:

model = Sequential()
model.add(Conv2D(filters = 32, kernel_size = (5,5),padding = 'Same', activation ='relu', input_shape = (train_X.shape[0], train_X.shape[2], 1)))
model.compile(optimizer='adam', loss=['binary_crossentropy'], metrics=['accuracy'])
history = model.fit(train_X, y_train, epochs=7, batch_size=72, validation_data=(test_X, y_test))   

Now the error is:

ValueError: Error when checking input: expected conv2d_38_input to have 4 dimensions, but got array with shape (985039, 1, 8)

I changed the input_shape in different ways but not solved. Can anyone know how to solve?

Roberto Caboni
  • 7,252
  • 10
  • 25
  • 39
  • 1
    Does this answer your question? [Keras input shape throws value error expected 4d but got an array with shape (60000, 28,28)](https://stackoverflow.com/questions/59972820/keras-input-shape-throws-value-error-expected-4d-but-got-an-array-with-shape-60) – ilke444 Mar 25 '20 at 04:46
  • Yes, it does. Thanks! – Nazanin Fouladgar Mar 25 '20 at 23:32

0 Answers0