In [3]:
import keras
In [4]:
from keras.models import Model, Sequential
import BoschNNModel1
In [8]:
bae = keras.models.load_model('1BAE_model_cols2-4.h5', custom_objects={"BoschNNInput":BoschNNModel1.BoschNNInput})
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-8-64af6bb9693a> in <module>()
----> 1 bae = keras.models.load_model('1BAE_model_cols2-4.h5', custom_objects={"BoschNNInput":BoschNNModel1.BoschNNInput})
d:\Anaconda\envs\Deep2\lib\site-packages\keras\models.pyc in load_model(filepath, custom_objects)
230 raise ValueError('No model found in config file.')
231 model_config = json.loads(model_config.decode('utf-8'))
--> 232 model = model_from_config(model_config, custom_objects=custom_objects)
233
234 # set weights
d:\Anaconda\envs\Deep2\lib\site-packages\keras\models.pyc in model_from_config(config, custom_objects)
291 'Maybe you meant to use '
292 '`Sequential.from_config(config)`?')
--> 293 return layer_module.deserialize(config, custom_objects=custom_objects)
294
295
d:\Anaconda\envs\Deep2\lib\site-packages\keras\layers\__init__.pyc in deserialize(config, custom_objects)
44 module_objects=globs,
45 custom_objects=custom_objects,
---> 46 printable_module_name='layer')
d:\Anaconda\envs\Deep2\lib\site-packages\keras\utils\generic_utils.pyc in deserialize_keras_object(identifier, module_objects, custom_objects, printable_module_name)
139 custom_objects=dict(list(_GLOBAL_CUSTOM_OBJECTS.items()) +
140 list(custom_objects.items())))
--> 141 return cls.from_config(config['config'])
142 else:
143 # Then `cls` may be a function returning a class.
d:\Anaconda\envs\Deep2\lib\site-packages\keras\models.pyc in from_config(cls, config)
1187 model = cls()
1188 for conf in config:
-> 1189 layer = layer_module.deserialize(conf)
1190 model.add(layer)
1191 return model
d:\Anaconda\envs\Deep2\lib\site-packages\keras\layers\__init__.pyc in deserialize(config, custom_objects)
44 module_objects=globs,
45 custom_objects=custom_objects,
---> 46 printable_module_name='layer')
d:\Anaconda\envs\Deep2\lib\site-packages\keras\utils\generic_utils.pyc in deserialize_keras_object(identifier, module_objects, custom_objects, printable_module_name)
131 if cls is None:
132 raise ValueError('Unknown ' + printable_module_name +
--> 133 ': ' + class_name)
134 if hasattr(cls, 'from_config'):
135 arg_spec = inspect.getargspec(cls.from_config)
ValueError: Unknown layer: BoschNNInput
In [26]:
from keras.models import Model, Sequential
In [31]:
model = Sequential()
model.load_weights('BAE_model_cols2-4.h5')
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-31-5e1791067c02> in <module>()
1 model = Sequential()
----> 2 model.load_weights('BAE_model_cols2-4.h5')
d:\Anaconda\envs\Deep2\lib\site-packages\keras\models.pyc in load_weights(self, filepath, by_name)
697
698 # Legacy support
--> 699 if legacy_models.needs_legacy_support(self):
700 layers = legacy_models.legacy_sequential_layers(self)
701 else:
d:\Anaconda\envs\Deep2\lib\site-packages\keras\legacy\models.pyc in needs_legacy_support(model)
3
4 def needs_legacy_support(model):
----> 5 return isinstance(model.layers[0], Merge)
6
7
IndexError: list index out of range
In [30]:
Object `model.load_weights` not found.
In [ ]:
Content source: zakkum42/Bosch
Similar notebooks: