This is my first CNN project on the M1 Mac, and I'm having InvalidArgumentError when I run model.fit().
I am using tensorflow-metal 3.0, tensorflow-macos 2.7 and running MacOS 12.1.
early_stop = EarlyStopping(monitor="val_accuracy", patience=10)
optimizer = tf.keras.optimizers.Adam(learning_rate=lr, amsgrad=True)
model.compile(optimizer=optimizer, loss='categorical_crossentropy', metrics=['accuracy'])
train_datagen = ImageDataGenerator(rescale = 1./255,
shear_range = 0.2,
zoom_range = 0.2,
horizontal_flip = True)
train_set = train_datagen.flow_from_directory(train_path,
target_size = (224, 224),
batch_size = batch_size,
class_mode = 'categorical')
res = model.fit(train_set,
validation_data=test_set,
batch_size=batch_size,
epochs=epochs,
steps_per_epoch=len(train_set),
validation_steps=len(test_set),
callbacks=[ckpt_saver, early_stop]
)
I have temporarily solved the problem by using another optimizers (not Adam).