i cant edit first post coz of multiple links, but the code is missing first line
feature_extractor_layer = hub.KerasLayer(
   "https://tfhub.dev/tensorflow/ssd_mobilenet_v2/2",
    input_shape=(300, 300, 3),
    dtype=tf.uint8,
    trainable=False)


num_classes = len(class_names)
print(num_classes)

#### using the Functional api ( doesnt work)
model= tf.keras.Model(
              feature_extractor_layer,
              tf.keras.layers.Dense(num_classes))
#### using keras.Sequential, doesnt work too
model = tf.keras.Sequential([
               feature_extractor_layer,
              tf.keras.layers.Dense(num_classes)
              ])

model.summary()