tensorflow2.0加载model出现AttributeError: ‘str‘ object has no attribute ‘decode‘

tensorflow2.0加载model出现AttributeError: ‘str’ object has no attribute ‘decode’

import tensorflow as tf
model = tf.keras.models.load_model(’/root/Web/test.h5’)
Traceback (most recent call last):
File “”, line 1, in
File “/usr/local/lib64/python3.6/site-packages/tensorflow_core/python/keras/saving/save.py”, line 146, in load_model
return hdf5_format.load_model_from_hdf5(filepath, custom_objects, compile)
File “/usr/local/lib64/python3.6/site-packages/tensorflow_core/python/keras/saving/hdf5_format.py”, line 166, in load_model_from_hdf5
model_config = json.loads(model_config.decode(‘utf-8’))
AttributeError: ‘str’ object has no attribute ‘decode’

解决方法

pip install h5py==2.10.0

你可能感兴趣的:(机器学习及深度学习,python,tensorflow,深度学习)