Resolved: error in saving a cnn model
model = tf.keras.models.Sequential()
model.add(Conv2D(filters=32, kernel_size=(3,3), activation='relu', input_shape=[256,256,3]))
model.add(tf.keras.layers.MaxPool2D(pool_size = (2,2)))
model.add(tf.keras.layers.Flatten())
model.add(tf.keras.layers.Dense( units=128,activation='relu'))
model.add(tf.keras.layers.Dense(4, activation='softmax'))
model.compile(optimizer='adam', loss='categorical_crossentropy', metrics=['accuracy'])
history = model.fit(train_gen,
epochs=20,
verbose=1
)
model.save("rock-paper-scissors-model.h5")
AND IT IS SHOWING THIS ERROR
NotImplementedError: Layer ModuleWrapper has arguments in `__init__` and therefore must override `get_config`.
Hi,
This error might be caused because your convolutional layer is Conv2D, instead of tf.keras.layers.Conv2D
Mixing imports between keras and tf.keras can also lead to this error
Hope this helps
Nest,
365 Team