Open za13 opened 5 years ago
I tried this example using latest keras2onnx code, it indeed has errors like:
File "E:\dev\keras-onnx\keras2onnx\main.py", line 82, in convert_keras
parse_graph(topology, tf_graph, target_opset, output_names)
File "E:\dev\keras-onnx\keras2onnx\parser.py", line 800, in parse_graph
return _parse_graph_core(graph, keras_layer_ts_map, topo, top_level, output_names)
File "E:\dev\keras-onnx\keras2onnx\parser.py", line 759, in _parse_graph_core
_infer_graph_shape(topology, top_scope, varset)
File "E:\dev\keras-onnx\keras2onnx\parser.py", line 479, in _infer_graph_shape
_finalize_tf2onnx_op(topology, oop, varset)
File "E:\dev\keras-onnx\keras2onnx\parser.py", line 449, in _finalize_tf2onnx_op
g = tf2onnx_wrap(topo, subgraph, outputs, varset.target_opset)
File "E:\dev\keras-onnx\keras2onnx\wrapper.py", line 300, in tf2onnx_wrap
raise e
File "E:\dev\keras-onnx\keras2onnx\wrapper.py", line 294, in tf2onnx_wrap
output_names=outputs)
File "E:\dev\keras-onnx\keras2onnx\ktf2onnx\tf2onnx\tfonnx.py", line 569, in process_tf_graph
topological_sort(g, continue_on_error)
File "E:\dev\keras-onnx\keras2onnx\ktf2onnx\tf2onnx\tfonnx.py", line 407, in topological_sort
g.topological_sort(ops)
File "E:\dev\keras-onnx\keras2onnx\ktf2onnx\tf2onnx\graph.py", line 835, in topological_sort
utils.make_sure(j is not None, "Cannot find node with output {}".format(inp))
File "E:\dev\keras-onnx\keras2onnx\ktf2onnx\tf2onnx\utils.py", line 290, in make_sure
raise ValueError("make_sure failure: " + error_msg % args)
ValueError: make_sure failure: Cannot find node with output TFNodes/block1b_drop/cond/Merge:1
This error happens inside tensorflow2onnx converter -- For the custom layers we have to use tensorflow2onnx converter to converter this particular layer. It seems that the rewrite_cond
in tensorflow2onnx has some bugs.
@jiafatom , why wasn't this dropout layer handled by the keras own converter?
@wenbingl This code use a customized dropout layer defined here, it is inherited from keras dropout, but not the keras one.
In that case, can this layer be converted by keras2onnx.set_converter?
@wenbingl Making this FixedDropout class public, we work around this issue. Now the issue is RuntimeError: Unsupported activation method within Activation layer '<function get_swish.<locals>.swish at 0x000001560D326400>'
This is because the code uses a customized activation swish
not the keras existing activations.
I'm using code from https://github.com/qubvel/segmentation_models/blob/master/examples/multiclass%20segmentation%20(camvid).ipynb
I'm trying to use keras2onnx with it also. I tried
But I got the following error: