Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'str' object has no attribute 'decode' #179

Open
LZZ383 opened this issue Dec 16, 2021 · 3 comments
Open

AttributeError: 'str' object has no attribute 'decode' #179

LZZ383 opened this issue Dec 16, 2021 · 3 comments

Comments

@LZZ383
Copy link

LZZ383 commented Dec 16, 2021

#from keras_vggface.vggface import VGGFace

VGGFace ResNet50

#vggface = VGGFace(include_top=False, model='resnet50', input_shape=(224, 224, 3))'

from colab_demo.vggface_models import RESNET50
vggface = RESNET50(include_top=False, weights=None, input_shape=(224, 224, 3))
vggface.load_weights("rcmalli_vggface_tf_notop_resnet50.h5")

#from keras.applications.resnet50 import ResNet50
#vggface = ResNet50(include_top=False, input_shape=(224, 224, 3))

#vggface.summary()

model.build_pl_model(vggface_model=vggface, before_activ=loss_config["PL_before_activ"])
model.build_train_functions(loss_weights=loss_weights, **loss_config)

Error:

AttributeError Traceback (most recent call last)
in ()
6 from colab_demo.vggface_models import RESNET50
7 vggface = RESNET50(include_top=False, weights=None, input_shape=(224, 224, 3))
----> 8 vggface.load_weights("rcmalli_vggface_tf_notop_resnet50.h5")
9
10 #from keras.applications.resnet50 import ResNet50

1 frames
/usr/local/lib/python3.7/dist-packages/keras/engine/topology.py in load_weights_from_hdf5_group(f, layers, reshape)
3326 """
3327 if 'keras_version' in f.attrs:
-> 3328 original_keras_version = f.attrs['keras_version'].decode('utf8')
3329 else:
3330 original_keras_version = '1'

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

@skiwheelr
Copy link

This seems to be an issue with the upgrade to tensorflow 2.0

https://stackoverflow.com/questions/58574610/python3-recognizes-tensorflow-but-doesnt-recognize-any-of-its-attributes

I can see what the problem is, but i'm not sure how to rectify it.

@skiwheelr
Copy link

There is an open PR that should fix some of these.

@mushfiq-ncsu
Copy link

I solved this in this way: (tested multiple time on different machines)

pip install 'h5py==2.10.0' --force-reinstall

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants