image-segmentation-keras icon indicating copy to clipboard operation
image-segmentation-keras copied to clipboard

TypeError: train() got an unexpected keyword argument 'callbacks'

Open fferlito opened this issue 1 year ago • 0 comments

I used to use this repo using callbacks, so I could terminate the training with early stopping. I recently discovered that this is not an option anymore, and the parameter is not working anymore. Is there a reason of this?

This is the code that I used to run:

model = mobilenet_unet(n_classes=11,  input_height=1024, input_width=1024, channels=3  )
# When using custom callbacks, the default checkpoint saver is removed
callbacks = [
    ModelCheckpoint(
                filepath=checkpoint_path,
                save_weights_only=True,
                verbose=True,
                save_best_only=True,
                monitor='val_accuracy'
            ),
    EarlyStopping(patience=50,
                  monitor='val_accuracy')
]

print("Start training...")
model.train(
    train_images =  "train/backup/train_images/",
    train_annotations = "train/backup/train_labels/",
    epochs=100000,
    batch_size=5,
    gen_use_multiprocessing=False,
    do_augment=True,
    augmentation_name='aug_all',
    validate=True,
    val_images="train/test_images/",
    val_annotations="train//test_labels/",
    val_batch_size=1,
    steps_per_epoch=14,
    val_steps_per_epoch=19,
    #steps_per_epoch=733,
    #val_steps_per_epoch=73,
    callbacks=callbacks
)

From which I get: model.train( TypeError: train() got an unexpected keyword argument 'callbacks'

fferlito avatar Oct 24 '23 17:10 fferlito