From f70083bea4de8a4ca31f4693fd2f60ce89c3482a Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Wed, 1 Mar 2023 17:19:10 +0000 Subject: [PATCH] dlr eo: set custom_objects when loading model --- aimodel/src/deeplabv3_plus_test_rainfall.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/aimodel/src/deeplabv3_plus_test_rainfall.py b/aimodel/src/deeplabv3_plus_test_rainfall.py index 8d7ff35..8b9e4c4 100755 --- a/aimodel/src/deeplabv3_plus_test_rainfall.py +++ b/aimodel/src/deeplabv3_plus_test_rainfall.py @@ -156,7 +156,10 @@ if PATH_CHECKPOINT is None: model = DeeplabV3Plus(image_size=IMAGE_SIZE, num_classes=NUM_CLASSES, num_channels=8) summarywriter(model, os.path.join(DIR_OUTPUT, "summary.txt")) else: - model = tf.keras.models.load_model(PATH_CHECKPOINT) + model = tf.keras.models.load_model(PATH_CHECKPOINT, custom_objects={ + # Tell Tensorflow about our custom layers so that it can deserialise models that use them + "LossCrossEntropyDice": LossCrossEntropyDice + })