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

The input layers of the model you created needs a 4 dimension tensor to work with but the x_train tensor you are passing to it has only 3 dimensions

This means that you have to reshape your training set with .reshape(n_images, 286, 384, 1). Now you have added an extra dimension without changing the data and your model is ready to run.

you need to reshape your x_train tensor to a 4 dimension before training your model.
for example:

x_train = x_train.reshape(-1, 28, 28, 1)

for more info on keras inputs Check this answer

Leave a Comment