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 trying to read model from keras/caffe/models/googleNet_structure.json #13

Open
ternaus opened this issue Jul 11, 2016 · 2 comments

Comments

@ternaus
Copy link

ternaus commented Jul 11, 2016

I am trying to read googleNet model from an example that may be found in the repository, but I get an error

model = model_from_json(open('models/googleNet_structure.json').read())

File "/usr/local/lib/python2.7/dist-packages/Keras-1.0.5-py2.7.egg/keras/models.py", line 36, in model_from_json
return layer_from_config(config, custom_objects=custom_objects)
File "/usr/local/lib/python2.7/dist-packages/Keras-1.0.5-py2.7.egg/keras/utils/layer_utils.py", line 35, in layer_from_config
return layer_class.from_config(config['config'])
File "/usr/local/lib/python2.7/dist-packages/Keras-1.0.5-py2.7.egg/keras/engine/topology.py", line 2271, in from_config
process_layer(layer_data)
File "/usr/local/lib/python2.7/dist-packages/Keras-1.0.5-py2.7.egg/keras/engine/topology.py", line 2249, in process_layer
custom_objects=custom_objects)
File "/usr/local/lib/python2.7/dist-packages/Keras-1.0.5-py2.7.egg/keras/utils/layer_utils.py", line 35, in layer_from_config
return layer_class.from_config(config['config'])
File "/usr/local/lib/python2.7/dist-packages/Keras-1.0.5-py2.7.egg/keras/engine/topology.py", line 896, in from_config
return cls(**config)
File "/usr/local/lib/python2.7/dist-packages/Keras-1.0.5-py2.7.egg/keras/layers/convolutional.py", line 283, in init
super(Convolution2D, self).init(**kwargs)
File "/usr/local/lib/python2.7/dist-packages/Keras-1.0.5-py2.7.egg/keras/engine/topology.py", line 302, in init
assert kwarg in allowed_kwargs, 'Keyword argument not understood: ' + kwarg
AssertionError: Keyword argument not understood: b_learning_rate_multiplier

@MarcBS
Copy link
Owner

MarcBS commented Jul 11, 2016

I am using the very same model right now and it is working perfectly fine.

Could it be that you are using the original repository of Keras to load the model? The parameter 'b_learning_rate_multiplier' is specific for this fork and does not exist in the original repo.

@ternaus
Copy link
Author

ternaus commented Jul 23, 2016

Yes, it was an issue.

Still I have problem with GoogleNet:

I am trying to fine tune, but this requires replacing output. Currently I do:

model.layers.pop()
model.outputs = [model.layers[-1].output]
 model.layers[-1].outbound_nodes = []
 model.add(Dense(10, activation='softmax'))

This worked with VGG16 and original Keras. But I get an error here:

model.add(Dense(10, activation='softmax'))
AttributeError: 'Model' object has no attribute 'add'

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

2 participants