I have M1 Mac, and I installed TensorFlow on it. It was working normally, until CNN code in week 3, course 1. I receive the following error:
ValueError: Input 0 of layer sequential_17 is incompatible with the layer: : expected min_ndim=4, found ndim=3. Full shape received: (32, 28, 28)
Any idea on how to fix this?
Hi,
Here the problem is with the number of channels in your image, you need 1 on the third dimesnion on your input image saying to it’s grayscale. Reshape the images to (28,28,1) and then create a batched dataset, so your batched data will be of dimensions (32,28,28,1). you could so this using “np.expand_dims()”. Let me know if this does not work.
Thanks!
Is your issue resolved sir
I had the same issue and i resolved it with:
[code removed - moderator]
I then used these new values “training_images_modified” when fitting and “test_images_modified” when evaluating the model.
Note that the reason why this error occurred was because the images were (28 x 28 ) without the 1. (ie 28 x 28 x 1).