Closed qqc222111 closed 6 months ago
Hi dear,
For the custom_object "dice", you can ignore it by compile = False during load model. During the load model, follow this:
model = tf.keras.models.load_model("your model name", compile = False)
You can solve that problem!
Thank you so much for raising this issue
Thanks for your answering. But I met the error when I use train.py, I can't find the code you refered in train.py and it occurs in the code below. Whether it may be caused by the version of tensorflow?
his = model.fit(train_dataset,
epochs=epochs,
verbose=1,
callbacks=callbacks,
steps_per_epoch=steps_per_epoch,
validation_data=valid_dataset, )
Hi, thanks for your response. To solve this problem, we can add directly the loss function to the compile attribute of the model via this code:
model.compile(optimizer = opts,
loss= dice_loss,
metrics=[dice_coeff,bce_dice_loss, IoU, zero_IoU])
Let me know if you can fix it :>
Thank you very much for solving my problem!
It's my pleasure. I will close this issue, thanks for raising it :>
Hello, I set my virtual environment according to your requirement, python3.9, tensorflow2.11, but I met the error ValueError: Unknown loss function: 'dice'. Please ensure you are using a
keras.utils.custom_object_scope
and that this object is included in the scope.