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

error with the load_model_weights function #14

Open
KhawlaSeddiki opened this issue Nov 11, 2019 · 0 comments
Open

error with the load_model_weights function #14

KhawlaSeddiki opened this issue Nov 11, 2019 · 0 comments

Comments

@KhawlaSeddiki
Copy link

KhawlaSeddiki commented Nov 11, 2019

@jacobgil

I’am using your code for VGG-16 pre-trained model for Keras but with my own weights.

f = h5py.File(weights_path) nb_layers = len(f.attrs["layer_names"]) for k in range(nb_layers): if k >= len(model_MS.layers): # without the last (fully-connected) layers in the savefile break g = f['layer_{}'.format(k)] weights = [g['param_{}'.format(p)] for p in range(g.attrs['nb_params'])] model.layers[k].set_weights(weights) model.layers[k].trainable = False f.close() print

This is the error I'm having:
KeyError: "Can't open attribute (can't locate attribute: 'nb_params')"

g has only this attributes : ['weight_names']

I described my error in this post:
https://stackoverflow.com/questions/58806714/keyerror-cant-open-attribute-cant-locate-attribute-nb-params

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

1 participant