Closed jlaxman closed 2 years ago
I am facing issues while loading weights from Meso4_DF.h5 file. Can you help me figure it out this error?
@DariusAf @abhishekberaoctra
AttributeError Traceback (most recent call last) /var/folders/_d/3lw9778n4x507_np6pxqkgsc0000gn/T/ipykernel_11257/4180714191.py in 1 # Instantiate a MesoNet model with pretrained weights 2 classifier = Meso4() ----> 3 classifier.load('./weights/Meso4_DF.h5')
/var/folders/_d/3lw9778n4x507_np6pxqkgsc0000gn/T/ipykernel_11257/2096412517.py in load(self, path) 15 16 def load(self, path): ---> 17 self.model.load_weights(path)
~/opt/anaconda3/envs/tf/lib/python3.7/site-packages/tensorflow_core/python/keras/engine/training.py in load_weights(self, filepath, by_name) 179 raise ValueError('Load weights is not yet supported with TPUStrategy ' 180 'with steps_per_run greater than 1.') --> 181 return super(Model, self).load_weights(filepath, by_name) 182 183 @trackable.no_automatic_dependency_tracking
~/opt/anaconda3/envs/tf/lib/python3.7/site-packages/tensorflow_core/python/keras/engine/network.py in load_weights(self, filepath, by_name) 1175 saving.load_weights_from_hdf5_group_by_name(f, self.layers) 1176 else: -> 1177 saving.load_weights_from_hdf5_group(f, self.layers) 1178 1179 def _updated_config(self):
~/opt/anaconda3/envs/tf/lib/python3.7/site-packages/tensorflow_core/python/keras/saving/hdf5_format.py in load_weights_from_hdf5_group(f, layers) 649 """ 650 if 'keras_version' in f.attrs: --> 651 original_keras_version = f.attrs['keras_version'].decode('utf8') 652 else: 653 original_keras_version = '1'
AttributeError: 'str' object has no attribute 'decode'
got it resolved by downgrading h5py to 2.10.4.
For more: https://stackoverflow.com/questions/53740577/does-any-one-got-attributeerror-str-object-has-no-attribute-decode-whi
I am facing issues while loading weights from Meso4_DF.h5 file. Can you help me figure it out this error?
@DariusAf @abhishekberaoctra
Instantiate a MesoNet model with pretrained weights
classifier = Meso4() classifier.load('./weights/Meso4_DF.h5')
AttributeError Traceback (most recent call last) /var/folders/_d/3lw9778n4x507_np6pxqkgsc0000gn/T/ipykernel_11257/4180714191.py in
1 # Instantiate a MesoNet model with pretrained weights
2 classifier = Meso4()
----> 3 classifier.load('./weights/Meso4_DF.h5')
/var/folders/_d/3lw9778n4x507_np6pxqkgsc0000gn/T/ipykernel_11257/2096412517.py in load(self, path) 15 16 def load(self, path): ---> 17 self.model.load_weights(path)
~/opt/anaconda3/envs/tf/lib/python3.7/site-packages/tensorflow_core/python/keras/engine/training.py in load_weights(self, filepath, by_name) 179 raise ValueError('Load weights is not yet supported with TPUStrategy ' 180 'with steps_per_run greater than 1.') --> 181 return super(Model, self).load_weights(filepath, by_name) 182 183 @trackable.no_automatic_dependency_tracking
~/opt/anaconda3/envs/tf/lib/python3.7/site-packages/tensorflow_core/python/keras/engine/network.py in load_weights(self, filepath, by_name) 1175 saving.load_weights_from_hdf5_group_by_name(f, self.layers) 1176 else: -> 1177 saving.load_weights_from_hdf5_group(f, self.layers) 1178 1179 def _updated_config(self):
~/opt/anaconda3/envs/tf/lib/python3.7/site-packages/tensorflow_core/python/keras/saving/hdf5_format.py in load_weights_from_hdf5_group(f, layers) 649 """ 650 if 'keras_version' in f.attrs: --> 651 original_keras_version = f.attrs['keras_version'].decode('utf8') 652 else: 653 original_keras_version = '1'
AttributeError: 'str' object has no attribute 'decode'