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) #9

Closed Aaryanverma closed 4 years ago

Aaryanverma commented 4 years ago

Getting this error while training the images. Also, I have checked, the dataset is successfully stored in the variable. Why this error is occurring?

`ValueError Traceback (most recent call last)

in 6 epochs = epochs, 7 validation_data = ([valid_img, valid_padded_txt, valid_input_length, valid_label_length],[np.zeros(len(valid_img))]), ----> 8 verbose = 1, callbacks = callbacks_list) E:\Anaconda\envs\PythonCPU\lib\site-packages\keras\engine\training.py in fit(self, x, y, batch_size, epochs, verbose, callbacks, validation_split, validation_data, shuffle, class_weight, sample_weight, initial_epoch, steps_per_epoch, validation_steps, validation_freq, max_queue_size, workers, use_multiprocessing, **kwargs) 1173 val_x, val_y, 1174 sample_weight=val_sample_weight, -> 1175 batch_size=batch_size) 1176 if self._uses_dynamic_learning_phase(): 1177 val_inputs = val_x + val_y + val_sample_weights + [0] E:\Anaconda\envs\PythonCPU\lib\site-packages\keras\engine\training.py in _standardize_user_data(self, x, y, sample_weight, class_weight, check_array_lengths, batch_size) 577 feed_input_shapes, 578 check_batch_axis=False, # Don't enforce the batch size. --> 579 exception_prefix='input') 580 581 if y is not None: E:\Anaconda\envs\PythonCPU\lib\site-packages\keras\engine\training_utils.py in standardize_input_data(data, names, shapes, check_batch_axis, exception_prefix) 133 ': expected ' + names[i] + ' to have ' + 134 str(len(shape)) + ' dimensions, but got array ' --> 135 'with shape ' + str(data_shape)) 136 if not check_batch_axis: 137 data_shape = data_shape[1:] ValueError: Error when checking input: expected input_9 to have 4 dimensions, but got array with shape (0, 1) ` **Here's my Code:** print(training_img.shape) print(train_padded_txt.shape) print(train_input_length.shape) print(train_label_length.shape) (3, 32, 128, 1) (3, 13) (3,) (3,) batch_size = 8 epochs = 20 model.fit(x=[training_img, train_padded_txt, train_input_length, train_label_length], y=np.zeros(len(training_img)), batch_size=batch_size, epochs = epochs, validation_data = ([valid_img, valid_padded_txt, valid_input_length, valid_label_length], [np.zeros(len(valid_img))]), verbose = 1, callbacks = callbacks_list)
jharsh1202 commented 4 years ago

the simplest solution is, just unzip the mjsynth.tar to mjsynth