Skip to content Skip to sidebar Skip to footer

Uncaught Error: Error When Checking : Expected Conv2d_input To Have 4 Dimension(s), But Got Array With Shape [275,183,3]

I performed following operations on the images before training my keras model: for img in os.listdir(path): # convert to array img_array = cv2.imread(os.path.join(path,

Solution 1:

It is related to a mismatch of the dimension of the input of the model and the dimension of the image passed in as parameter to the predict method.

One might consider reshaping the image the following way:

imageTensor.reshape([-1, 50, 50, 3])

Solution 2:

In the first example, with [256, (3,3), and the last thing], keras treats this list as having three dimensions or elements, when it is looking for four dimensions. Remove the parentheses to yield:

[256, 3, 3, input_shape=X.shape[1:]]

Post a Comment for "Uncaught Error: Error When Checking : Expected Conv2d_input To Have 4 Dimension(s), But Got Array With Shape [275,183,3]"