Untitled

 avatar
unknown
plain_text
5 months ago
2.0 kB
2
Indexable
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[58], line 5
      1 from tensorflow.keras.callbacks import EarlyStopping
      4 # Huấn luyện model với callback
----> 5 history = model.fit(X_train, y_train, epochs=30,validation_data=(X_val, y_val))
      7 model.save('my_model.h5')

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/layers/input_spec.py:227, in assert_input_compatibility(input_spec, inputs, layer_name)
    222     for axis, value in spec.axes.items():
    223         if value is not None and shape[axis] not in {
    224             value,
    225             None,
    226         }:
--> 227             raise ValueError(
    228                 f'Input {input_index} of layer "{layer_name}" is '
    229                 f"incompatible with the layer: expected axis {axis} "
    230                 f"of input shape to have value {value}, "
    231                 "but received input with "
    232                 f"shape {shape}"
    233             )
    234 # Check shape.
    235 if spec.shape is not None:

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

Input 0 of layer "conv2d_50" is incompatible with the layer: expected axis -1 of input shape to have value 1, but received input with shape (None, 224, 224, 3)

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