TheAILearner / A-CRNN-model-for-Text-Recognition-in-Keras

64 stars 33 forks source link

Error when checking input: expected input_1 to have 4 dimensions, but got array with shape (0, 1) #3

Closed karthimk21 closed 4 years ago

karthimk21 commented 4 years ago

I'm following your steps but getting the same error again and again Error when checking input: expected input_1 to have 4 dimensions, but got array with shape (0, 1)

Tanushree963 commented 4 years ago

Yes I got the same error as well.

srikanthmattupalli commented 4 years ago

download the data-set and set data-set path like given below Ex: path =r 'C:/downloads/mjsynth.tar/mnt/ramdisk/max/90kDICT32px'

veeri commented 4 years ago

pass imge numpy array to this method before passing to prediction def reshapeImage(img): img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) img = np.expand_dims(img , axis = 2) dim = (128, 32) img = cv2.resize(img, dim, interpolation = cv2.INTER_AREA) img = np.expand_dims(img , axis = 2) img = img/255. return img

Arunpoochelvan commented 4 years ago

Add the below line before mode.predict

valid_img = valid_img[np.newaxis, ...]

predict outputs on validation images

prediction = act_model.predict(valid_img)

Aaryanverma commented 4 years ago

Getting this same error while training the model. I have also checked my path for images. it is also correct. What can be the issue?