Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save srg9000/abb8eae6cba6e19c8569ac16f8d0f171 to your computer and use it in GitHub Desktop.
Save srg9000/abb8eae6cba6e19c8569ac16f8d0f171 to your computer and use it in GitHub Desktop.
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-68-2b1880c7abd4> in <module>()
----> 1 model = keras.models.load_model('gender_color_combined.h5', custom_objects={'Scale':Scale()})
9 frames
/usr/local/lib/python3.6/dist-packages/keras/engine/saving.py in load_wrapper(*args, **kwargs)
456 os.remove(tmp_filepath)
457 return res
--> 458 return load_function(*args, **kwargs)
459
460 return load_wrapper
/usr/local/lib/python3.6/dist-packages/keras/engine/saving.py in load_model(filepath, custom_objects, compile)
548 if H5Dict.is_supported_type(filepath):
549 with H5Dict(filepath, mode='r') as h5dict:
--> 550 model = _deserialize_model(h5dict, custom_objects, compile)
551 elif hasattr(filepath, 'write') and callable(filepath.write):
552 def load_function(h5file):
/usr/local/lib/python3.6/dist-packages/keras/engine/saving.py in _deserialize_model(h5dict, custom_objects, compile)
241 raise ValueError('No model found in config.')
242 model_config = json.loads(model_config.decode('utf-8'))
--> 243 model = model_from_config(model_config, custom_objects=custom_objects)
244 model_weights_group = h5dict['model_weights']
245
/usr/local/lib/python3.6/dist-packages/keras/engine/saving.py in model_from_config(config, custom_objects)
591 '`Sequential.from_config(config)`?')
592 from ..layers import deserialize
--> 593 return deserialize(config, custom_objects=custom_objects)
594
595
/usr/local/lib/python3.6/dist-packages/keras/layers/__init__.py in deserialize(config, custom_objects)
166 module_objects=globs,
167 custom_objects=custom_objects,
--> 168 printable_module_name='layer')
/usr/local/lib/python3.6/dist-packages/keras/utils/generic_utils.py in deserialize_keras_object(identifier, module_objects, custom_objects, printable_module_name)
145 config['config'],
146 custom_objects=dict(list(_GLOBAL_CUSTOM_OBJECTS.items()) +
--> 147 list(custom_objects.items())))
148 with CustomObjectScope(custom_objects):
149 return cls.from_config(config['config'])
/usr/local/lib/python3.6/dist-packages/keras/engine/network.py in from_config(cls, config, custom_objects)
1060 node_data = node_data_list[node_index]
1061 try:
-> 1062 process_node(layer, node_data)
1063
1064 # If the node does not have all inbound layers
/usr/local/lib/python3.6/dist-packages/keras/engine/network.py in process_node(layer, node_data)
1010 # and building the layer if needed.
1011 if input_tensors:
-> 1012 layer(unpack_singleton(input_tensors), **kwargs)
1013
1014 def process_layer(layer_data):
/usr/local/lib/python3.6/dist-packages/keras/engine/base_layer.py in __call__(self, inputs, **kwargs)
466 if all([s is not None
467 for s in to_list(input_shape)]):
--> 468 output_shape = self.compute_output_shape(input_shape)
469 else:
470 if isinstance(input_shape, list):
/usr/local/lib/python3.6/dist-packages/keras/engine/network.py in compute_output_shape(self, input_shape)
597 raise ValueError('Invalid input_shape argument ' +
598 str(input_shape) + ': model has ' +
--> 599 str(len(self._input_layers)) + ' tensor inputs.')
600
601 cache_key = ', '.join([str(x) for x in input_shapes])
ValueError: Invalid input_shape argument (None, 224, 224, 3): model has 0 tensor inputs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment