img_size = (224, 224)
channels = 3
img_shape = (img_size[0], img_size[1], channels)
class_count = len(list(train_gen.class_indices.keys()))
base_model = tf.keras.applications.efficientnet.EfficientNetB7(include_top=False, weights=”imagenet”, input_shape=img_shape, pooling=’max’)
base_model.trainable = False
model = Sequential([
base_model,
BatchNormalization(axis=-1, momentum=0.99, epsilon=0.001),
Dense(128, kernel_regularizer=regularizers.l2(l=0.016), activity_regularizer=regularizers.l1(0.006),
bias_regularizer=regularizers.l1(0.006), activation=’relu’),
Dropout(rate=0.45, seed=123),
Dense(class_count, activation=’softmax’)
])
model.compile(Adamax(learning_rate=0.002), loss=’categorical_crossentropy’, metrics=[‘accuracy’])
model.summary()
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[70], line 16
9 base_model = tf.keras.applications.efficientnet.EfficientNetB7(include_top=False, weights="imagenet", input_shape=img_shape, pooling='max')
11 base_model.trainable = False
13 model = Sequential([
14 base_model,
15 BatchNormalization(axis=-1, momentum=0.99, epsilon=0.001),
---> 16 Dense(128, kernel_regularizer=regularizers.l2(l=0.016), activity_regularizer=regularizers.l1(0.006),
17 bias_regularizer=regularizers.l1(0.006), activation='relu'),
18 Dropout(rate=0.45, seed=123),
19 Dense(class_count, activation='softmax')
20 ])
22 model.compile(Adamax(learning_rate=0.002), loss='categorical_crossentropy', metrics=['accuracy'])
25 model.summary()
TypeError: L2.__init__() got an unexpected keyword argument 'l'
Md Mehedi Hasan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.