Untitled

 avatar
unknown
plain_text
5 months ago
1.8 kB
2
Indexable
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[67], line 7
      4 for i in range(0,lenRange):
      5     sample = X_test[i].reshape(X_test[i].shape[0], X_test[i].shape[1],X_test[i].shape[2])
----> 7     predicted_probabilities = model.predict(sample)
      8     predicted_label = np.argmax(predicted_probabilities)
     10     if desired_categories[predicted_label] == desired_categories[y_test[i]]:

File /opt/conda/lib/python3.10/site-packages/keras/src/utils/traceback_utils.py:122, in filter_traceback.<locals>.error_handler(*args, **kwargs)
    119     filtered_tb = _process_traceback_frames(e.__traceback__)
    120     # To get the full stack trace, call:
    121     # `keras.config.disable_traceback_filtering()`
--> 122     raise e.with_traceback(filtered_tb) from None
    123 finally:
    124     del filtered_tb

File /opt/conda/lib/python3.10/site-packages/keras/src/models/functional.py:288, in Functional._adjust_input_rank(self, flat_inputs)
    286             adjusted.append(ops.expand_dims(x, axis=-1))
    287             continue
--> 288     raise ValueError(
    289         f"Invalid input shape for input {x}. Expected shape "
    290         f"{ref_shape}, but input has incompatible shape {x.shape}"
    291     )
    292 # Add back metadata.
    293 for i in range(len(flat_inputs)):

ValueError: Exception encountered when calling Sequential.call().

Invalid input shape for input Tensor("data:0", shape=(32, 224, 3), dtype=float32). Expected shape (None, 224, 224, 3), but input has incompatible shape (32, 224, 3)

Arguments received by Sequential.call():
  • inputs=tf.Tensor(shape=(32, 224, 3), dtype=float32)
  • training=False
  • mask=None
Editor is loading...
Leave a Comment