the error was nly instances of keras.Layer can be added to a Sequential model. Received: <tensorflow_hub.keras_layer.KerasLayer object at 0x7c77d7c78b50> (of type <class ‘tensorflow_hub.keras_layer.KerasLayer’>)
The hub.KerasLayer from TensorFlow Hub is not always recognized as a native keras.Layer in a Sequential model. Try using the Functional API instead of Sequential, as it fully supports KerasLayer and pay attention to the implementation guides in the notebook.
Hope it helps! Feel free to ask if you need further assistance.
Exception encountered when calling layer ‘keras_layer_3’ (type KerasLayer).
A KerasTensor is symbolic: it’s a placeholder for a shape an a dtype. It doesn’t have any actual numerical value. You cannot convert it to a NumPy array.
Call arguments received by layer ‘keras_layer_3’ (type KerasLayer):
• inputs=<KerasTensor shape=(None, None, None, 3), dtype=float32, sparse=False, name=keras_tensor_6>
• training=None
Exception encountered when calling layer ‘keras_layer_3’ (type KerasLayer).
A KerasTensor is symbolic: it’s a placeholder for a shape an a dtype. It doesn’t have any actual numerical value. You cannot convert it to a NumPy array.
Call arguments received by layer ‘keras_layer_3’ (type KerasLayer):
• inputs=<KerasTensor shape=(None, None, None, 3), dtype=float32, sparse=False, name=keras_tensor_6>
• training=None
The error occurs because the hub.KerasLayer expects inputs with a fully defined shape (like (224, 224, 3)), but it’s receiving a symbolic tensor with undefined spatial dimensions (None, None, None, 3). You should define the input shape explicitly using tf.keras.Input(shape=(224, 224, 3)) and ensure the input images are properly resized and preprocessed to match the expected format of the Hub model.