Keras ValueError: Input 0 is incompatible with layer conv2d_1: expected ndim=4, found ndim=5

The problem is input_shape.

It should actually contain 3 dimensions only. And internally keras will add the batch dimension making it 4.

Since you probably used input_shape with 4 dimensions (batch included), keras is adding the 5th.

You should use input_shape=(32,32,1).

Leave a Comment