I have a script here that
my_model.to_json and then writing the json_string to a file.model_from_json. The current version of this gist runs and reloads the model fine. But uncommenting lines 25-26 causes an exception when you try and reload the model.The error message is Missing layer: end_img.
This was especially surprising since the line that you uncomment seems not to have any relation to the layer in that error message.
It's an actual bug in the serialization process, that occurs with some specific funky graphs that include shared layers. I'm rolling out a fix.
I pushed the fix.
Thanks. It's amazing how much you do maintaining Keras.
I owe a huge debt to you and the keras community, which I hope to make progress paying back some day.
@fchollet I still faced this issue in keras version 1.1.2.
../keras/engine/topology.pyc in process_layer(layer_data)
2380 for input_data in node_data:
2381 inbound_layer_name, inbound_node_index, inbound_tensor_index = input_data
-> 2382 assert inbound_layer_name in created_layers, 'Missing layer: %s' % inbound_layer_name
2383 inbound_layer = created_layers[inbound_layer_name]
2384 inbound_node = inbound_layer.inbound_nodes[inbound_node_index]
AssertionError: Missing layer: input_1
I have the same issue with version 1.2.0. model_from_json() function throw this error when I try to load the model that I just trained.
Most helpful comment
I pushed the fix.