gmalivenko / onnx2keras

Convert ONNX model graph to Keras model format.
MIT License
195 stars 116 forks source link

[Regression] ValueError: The name "151" is used 4 times in the model. All layer names should be unique. #7

Closed SleepProgger closed 5 years ago

SleepProgger commented 5 years ago

With the current version i am not able to export S3FD anymore. Tested with you gist from the split issue in keras2onnx (https://gist.github.com/nerox8664/cbf70c39967b59d29f49afd9f9205a1b) This happens regardless of setting a name_policy or not.

Traceback (most recent call last):
  File "foo.py", line 151, in <module>
    k_model = onnx_to_keras(onnx_model, ['input'])
  File "/home/nope/workspace/onnx2keras/onnx2keras/converter.py", line 205, in onnx_to_keras
    model = keras.models.Model(inputs=keras_inputs, outputs=keras_outputs)
  File "/home/nope/.local/lib/python3.7/site-packages/keras/legacy/interfaces.py", line 91, in wrapper
    return func(*args, **kwargs)
  File "/home/nope/.local/lib/python3.7/site-packages/keras/engine/network.py", line 93, in __init__
    self._init_graph_network(*args, **kwargs)
  File "/home/nope/.local/lib/python3.7/site-packages/keras/engine/network.py", line 231, in _init_graph_network
    self.inputs, self.outputs)
  File "/home/nope/.local/lib/python3.7/site-packages/keras/engine/network.py", line 1455, in _map_graph_network
    ' times in the model. '
ValueError: The name "151" is used 4 times in the model. All layer names should be unique.

151 is one of the 4 outputs of the split layer. So it seems like this is realted to layers with multiple outputs.

SleepProgger commented 5 years ago

Ok, so it is because in https://github.com/nerox8664/onnx2keras/blob/master/onnx2keras/operation_layers.py#L208 all outputs get the same name. Expect a PR soon(ish)