import kagglehub
# Download latest version
path = kagglehub.model_download("google/mobilenet-v2/tensorFlow2/tf2-preview-feature-vector")
mobile_net = hub.KerasLayer("https://tfhub.dev/google/tf2-preview/mobilenet_v2/feature_vector/4",
input_shape=(224, 224, 3), # Change as per your input size
trainable=False) # Freeze weights if you don't want to fine-tune
# Define the Sequential model
model = tf.keras.models.Sequential([
mobile_net, # Use the pre-trained model as the first layer
tf.keras.layers.Dense(1, activation='sigmoid') # Final layer for binary classification
])
Я хочу решить проблему, но не могу, и мне нужна помощь.
[code]ValueError: Only instances of `keras.Layer` can be added to a Sequential model. Received: (of type ) [/code] код: [code]import kagglehub
# Download latest version path = kagglehub.model_download("google/mobilenet-v2/tensorFlow2/tf2-preview-feature-vector") mobile_net = hub.KerasLayer("https://tfhub.dev/google/tf2-preview/mobilenet_v2/feature_vector/4", input_shape=(224, 224, 3), # Change as per your input size trainable=False) # Freeze weights if you don't want to fine-tune
# Define the Sequential model model = tf.keras.models.Sequential([ mobile_net, # Use the pre-trained model as the first layer tf.keras.layers.Dense(1, activation='sigmoid') # Final layer for binary classification ]) [/code] Я хочу решить проблему, но не могу, и мне нужна помощь.