jakeret/unet

Error loading saved model

paolocolourblind opened this issue · 1 comments

I am getting the error below right after executing this command:

unet_model = tf.keras.models.load_model("M:\\ant\\2021-06-04T22-22_27", custom_objects=custom_objects)

File "segmenter2-generator.py", line 152, in evaluate unet_model = tf.keras.models.load_model("M:\\anthurium\\ant\\2021-06-04T22-22_27", custom_objects=None, compile=False) File "C:\Users\JP\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\keras\saving\save.py", line 206, in load_model return saved_model_load.load(filepath, compile, options) File "C:\Users\JP\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\keras\saving\saved_model\load.py", line 155, in load keras_loader.finalize_objects() File "C:\Users\JP\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\keras\saving\saved_model\load.py", line 626, in finalize_objects self._reconstruct_all_models() File "C:\Users\JP\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\keras\saving\saved_model\load.py", line 645, in _reconstruct_all_models self._reconstruct_model(model_id, model, layers) File "C:\Users\JP\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\keras\saving\saved_model\load.py", line 692, in _reconstruct_model config, created_layers={layer.name: layer for layer in layers}) File "C:\Users\JP\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\keras\engine\functional.py", line 1289, in reconstruct_from_config process_node(layer, node_data) File "C:\Users\JP\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\keras\engine\functional.py", line 1237, in process_node output_tensors = layer(input_tensors, **kwargs) File "C:\Users\JP\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\keras\engine\base_layer.py", line 970, in __call__ input_list) File "C:\Users\JP\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\keras\engine\base_layer.py", line 1108, in _functional_construction_call inputs, input_masks, args, kwargs) File "C:\Users\JP\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\keras\engine\base_layer.py", line 840, in _keras_tensor_symbolic_call return self._infer_output_signature(inputs, args, kwargs, input_masks) File "C:\Users\JP\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\keras\engine\base_layer.py", line 880, in _infer_output_signature outputs = call_fn(inputs, *args, **kwargs) File "C:\Users\JP\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\keras\saving\saved_model\utils.py", line 69, in return_outputs_and_add_losses outputs, losses = fn(*args, **kwargs) File "C:\Users\JP\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\keras\saving\saved_model\utils.py", line 167, in wrap_with_training_arg lambda: replace_training_and_call(False)) File "C:\Users\JP\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\keras\utils\control_flow_util.py", line 110, in smart_cond pred, true_fn=true_fn, false_fn=false_fn, name=name) File "C:\Users\JP\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\smart_cond.py", line 56, in smart_cond return false_fn() File "C:\Users\JP\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\keras\saving\saved_model\utils.py", line 167, in <lambda> lambda: replace_training_and_call(False)) File "C:\Users\JP\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\keras\saving\saved_model\utils.py", line 163, in replace_training_and_call return wrapped_call(*args, **kwargs) File "C:\Users\JP\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\eager\def_function.py", line 889, in __call__ result = self._call(*args, **kwds) File "C:\Users\JP\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\eager\def_function.py", line 933, in _call self._initialize(args, kwds, add_initializers_to=initializers) File "C:\Users\JP\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\eager\def_function.py", line 764, in _initialize *args, **kwds)) File "C:\Users\JP\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\eager\function.py", line 3050, in _get_concrete_function_internal_garbage_collected graph_function, _ = self._maybe_define_function(args, kwargs) File "C:\Users\JP\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\eager\function.py", line 3397, in _maybe_define_function self._function_spec.canonicalize_function_inputs(*args, **kwargs) File "C:\Users\JP\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\eager\function.py", line 2752, in canonicalize_function_inputs self.signature_summary(), missing_args[0])) TypeError: f(inputs, training, training, training, training, *, training, training) missing 1 required argument: training

Any tips what is causing this and how to solve this?

Thanks

I encounter the same problem too...
This problem occurs from time to time. Sometimes it works, sometimes it doesn't with the same exact parameters.