Loading model weights from h5_file: ./brainbow_3d_detection/model_weights_unet_3d_detection_P14_big_1.h5
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Input In [16], in <cell line: 1>()
----> 1 engine.test()
File ~/workspace/BiaPy/engine/engine.py:208, in Engine.test(self)
205 def test(self):
207 print("Loading model weights from h5_file: {}".format(self.cfg.PATHS.CHECKPOINT_FILE))
--> 208 self.model.load_weights(self.cfg.PATHS.CHECKPOINT_FILE)
210 image_counter = 0
211 if self.cfg.TEST.POST_PROCESSING.BLENDING or self.cfg.TEST.POST_PROCESSING.YZ_FILTERING or \
212 self.cfg.TEST.POST_PROCESSING.Z_FILTERING:
File ~/miniconda3/envs/EM_tools/lib/python3.8/site-packages/tensorflow/python/keras/engine/training.py:2234, in Model.load_weights(self, filepath, by_name, skip_mismatch, options)
2231 hdf5_format.load_weights_from_hdf5_group_by_name(
2232 f, self.layers, skip_mismatch=skip_mismatch)
2233 else:
-> 2234 hdf5_format.load_weights_from_hdf5_group(f, self.layers)
File ~/miniconda3/envs/EM_tools/lib/python3.8/site-packages/tensorflow/python/keras/saving/hdf5_format.py:685, in load_weights_from_hdf5_group(f, layers)
683 layer_names = filtered_layer_names
684 if len(layer_names) != len(filtered_layers):
--> 685 raise ValueError('You are trying to load a weight file '
686 'containing ' + str(len(layer_names)) +
687 ' layers into a model with ' + str(len(filtered_layers)) +
688 ' layers.')
690 # We batch weight value assignments in a single backend call
691 # which provides a speedup in TensorFlow.
692 weight_value_tuples = []
ValueError: You are trying to load a weight file containing 18 layers into a model with 13 layers.
Desc
Follow up of #21. It looks like either I got a wrong model weight or I have to use a model other than
unet
? Thank you for your help in advance!What I did
Config is the same as #21. I checked that cfg merged specified settings from the given config file.
config
Script
Check loaded cfg
Error msg