satellite_unet custom_objects: '<' not supported between instances of 'function' and 'str'
See original GitHub issueI’m trying to continue training model “satellite_unet” by loading weights. but got this issue when using custom_objects
here is the code `model = satellite_unet( input_shape, ) callback_checkpoint = ModelCheckpoint( os.path.join(checkpoint_path, ‘weights.{epoch:02d}.{val_loss:.4f}.hdf5’), verbose=1, monitor=‘val_loss’, save_best_only=True ) model.compile( optimizer=SGD(lr=0.01, momentum=0.99), loss=‘binary_crossentropy’, metrics=[iou, iou_thresholded] )
####### if checkpoints exist get last_epoch …
model = load_model(os.path.join(checkpoint_path, checkpoint_path_file), custom_objects={ “iou”: iou, “iou_thresholded”: iou_thresholded, }) history = model.fit( train_gen, steps_per_epoch=len(x_train), epochs=EPOCHS, validation_data=(x_val, y_val), callbacks=[callback_checkpoint], initial_epoch=last_epoch )`
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top GitHub Comments
No other option than just training it for a bit and running some predictions to see 😃
I think it works now after I changed the compile option for False and compile the model after loading it from the last checkpoints
It now continues training from the last checkpoints. But is there a way to make sure it works?