original_keras_version = f.attrs[‘keras_version‘].decode(‘utf8‘) AttributeError: ‘str‘ object has no

Error:
original_keras_version = f.attrs['keras_version'].decode('utf8')
AttributeError: 'str' object has no attribute 'decode'

When I was training MobileNet, I reported the above error, and I found out that it was because a higher version of h5py was installed by default when TensorFlow was installed, and the version was checked to be 3.1.0.

Solution:
Uninstall the high version h5py and install the low version h5py

uninstall

pip uninstall h5py

Install

pip install h5py==2.10.0

Run successfully!

Guess you like

Origin blog.csdn.net/Zeus_daifu/article/details/128608463