keras_openvino icon indicating copy to clipboard operation
keras_openvino copied to clipboard

Input misshape error

Open neftaliw opened this issue 5 years ago • 1 comments

Tried running the very first cell and got a misshape error


ValueError Traceback (most recent call last) in () 30 x = preprocess_input(x) 31 ---> 32 preds = model.predict(x) 33 # decode the results into a list of tuples (class, description, probability) 34 # (one such list for each sample in the batch)

~\AppData\Roaming\Python\Python37\site-packages\tensorflow_core\python\keras\engine\training.py in predict(self, x, batch_size, verbose, steps, callbacks, max_queue_size, workers, use_multiprocessing) 906 max_queue_size=max_queue_size, 907 workers=workers, --> 908 use_multiprocessing=use_multiprocessing) 909 910 def reset_metrics(self):

~\AppData\Roaming\Python\Python37\site-packages\tensorflow_core\python\keras\engine\training_arrays.py in predict(self, model, x, batch_size, verbose, steps, callbacks, **kwargs) 714 batch_size = model._validate_or_infer_batch_size(batch_size, steps, x) 715 x, _, _ = model._standardize_user_data( --> 716 x, check_steps=True, steps_name='steps', steps=steps) 717 return predict_loop( 718 model,

~\AppData\Roaming\Python\Python37\site-packages\tensorflow_core\python\keras\engine\training.py in _standardize_user_data(self, x, y, sample_weight, class_weight, batch_size, check_steps, steps_name, steps, validation_split, shuffle, extract_tensors_from_dataset) 2469 feed_input_shapes, 2470 check_batch_axis=False, # Don't enforce the batch size. -> 2471 exception_prefix='input') 2472 2473 # Get typespecs for the input data and sanitize it if necessary.

~\AppData\Roaming\Python\Python37\site-packages\tensorflow_core\python\keras\engine\training_utils.py in standardize_input_data(data, names, shapes, check_batch_axis, exception_prefix) 570 ': expected ' + names[i] + ' to have shape ' + 571 str(shape) + ' but got array with shape ' + --> 572 str(data_shape)) 573 return data 574

ValueError: Error when checking input: expected input_1 to have shape (299, 299, 3) but got array with shape (224, 224, 3)

neftaliw avatar Jan 17 '20 23:01 neftaliw

Solved it by changing the img_height variable to 299

neftaliw avatar Jan 18 '20 00:01 neftaliw