i'm trying to preprocess set of images before passing it to the CNN model, and i had to convert it to greyscale because my model my model required to, the issue is when i save the converted image and load it , it works correctly without any errors because the shape is (244,244,3) but if i pass it directly to the model the shape of images be (None , 224,224) and it produced this error:
ValueError: Input 0 of layer sequential_5 is incompatible with the layer: : expected min_ndim=4, found ndim=3. Full shape received: (None, 224, 224)
the code is:
gray = cv2.cvtColor(crop_img, cv2.COLOR_BGR2GRAY)
resized_image = cv2.resize(crop_img, (224, 224))
frames.append(resized_image)
cv2.imwrite("/Users/naimahalaqeel/Documents/graduation project/toArabicText/test2/%d.jpg" % count2, resized_image)
count2 = count2 +1
success,image = vidcap.read()
count+=1
afterPrecceseFrames = np.array(frames)
predicted_classes = model.predict_classes(afterPrecceseFrames)