Added custom objects to recover saved model

Signed-off-by: Jim Martens <github@2martens.de>
This commit is contained in:
2019-07-09 12:13:41 +02:00
parent f5c8e9483a
commit 4bdd069650

View File

@ -307,6 +307,9 @@ def _ssd_test(args: argparse.Namespace) -> None:
from twomartens.masterthesis import data from twomartens.masterthesis import data
from twomartens.masterthesis import ssd from twomartens.masterthesis import ssd
from twomartens.masterthesis.ssd_keras.keras_layers import keras_layer_AnchorBoxes
from twomartens.masterthesis.ssd_keras.keras_layers import keras_layer_L2Normalization
config = tf.ConfigProto() config = tf.ConfigProto()
config.log_device_placement = False config.log_device_placement = False
@ -334,7 +337,10 @@ def _ssd_test(args: argparse.Namespace) -> None:
instances = pickle.load(file) instances = pickle.load(file)
# model # model
ssd_model = tf.keras.models.load_model(model_file) ssd_model = tf.keras.models.load_model(model_file, custom_objects={
"L2Normalization": keras_layer_L2Normalization.L2Normalization,
"AnchorBoxes": keras_layer_AnchorBoxes.AnchorBoxes
})
test_generator, length_dataset = \ test_generator, length_dataset = \
data.load_scenenet_data(file_names_photos, instances, coco_path, data.load_scenenet_data(file_names_photos, instances, coco_path,