I am trying to use a CNN keras model that I trained to classify images. I am using model.predict(img) and I am getting an error with the expected shape. It says the found shape=(None,100,3) and the expected shape=(None,100,100,3).
The CNN set up code is:
model = Sequential()
model.add(Conv2D(32, (3, 3), activation=’relu’, input_shape=(image_size, image_size,dim3)))
model.add(MaxPooling2D((2, 2)))
model.add(Conv2D(64, (3, 3), activation=’relu’))
model.add(MaxPooling2D((2, 2)))
model.add(Conv2D(64, (3, 3), activation=’relu’))
model.add(Flatten())
model.add(Dense(64, activation=’relu’))
model.add(Dense(2, activation=’softmax’))
where image_size = 100 and dim3 = 3
img.shape returs TensorShape([100,100,3]). Why is it expecting the first dimension to be none and how do I correctly use my trained CNN to classify and image?
Daniel Elkin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.