Home > Software design >  Error with the input_shape expected to have 4 dimensions, but got array with shape (73257, 32, 32)
Error with the input_shape expected to have 4 dimensions, but got array with shape (73257, 32, 32)

Time:11-24

I have greyscale images of this shape: x_train_grey.shape = (73257, 32, 32)

I specify the first layer like this:

Flatten(input_shape=(32,32,1)' Because I don't pass the batch_size and the greyscale images have only 1 channel. But I get this error:

ValueError: Error when checking input: expected flatten_1_input to have 4 dimensions, but got an array with shape (73257, 32, 32)

I don't understand what is wrong, please help. I understand this has been asked many times, but I cannot find a solution.

Cheers!

CodePudding user response:

I'm still learning this stuff too but I would guess that "1" as a dimension's number of entries isn't possible. Even if it is possible, it's a start. "1" as a size of an axis doesn't make sense to me. Anyone else?

CodePudding user response:

Greeting of the day, I looked into your problem and find a solution here is the link hope you get the solution for your problem, I am also learning this. please let me know if I gave you the solution, this is my first stack overflow reply, thank you

https://newbedev.com/error-when-checking-model-input-expected-convolution2d-input-1-to-have-4-dimensions-but-got-array-with-shape-32-32-3

  • Related