AttributeError: ‘str‘ object has no attribute ‘decode‘

运行代码时出现的错误

Traceback (most recent call last):
File “mitosis.py”, line 304, in
model.load_weights(weights_path, by_name=True)
File “/opt/anaconda3/envs/tfenv/lib/python3.6/site-packages/mask_rcnn-2.1-py3.6.egg/mrcnn/model.py”, line 2119, in load_weights
File “/opt/anaconda3/envs/tfenv/lib/python3.6/site-packages/keras/engine/topology.py”, line 3114, in load_weights_from_hdf5_group_by_name
original_keras_version = f.attrs[‘keras_version’].decode(‘utf8’)
AttributeError: ‘str’ object has no attribute 'decode

具体环境配置情况

tensorflow1.3.0
keras 2.0.8
h5py 3.1.0

解决方法

步骤1、将h5py卸载pip uninstall h5py
步骤2、安装指定版本的h5pypip install h5py==2.10.0

参考:https://github.com/tensorflow/tensorflow/issues/44467

你可能感兴趣的:(深度学习)