onnx2keras
onnx2keras copied to clipboard
Error : model inputs
Hi everybody,
I'd like to convert my tfjs graph model to keras. For this, I converted my model tfjs in onnx using the "tf2onnx" git.
And now, I need to use this git (.onnx to .h5).
But here, the error, I am currently facing:
Here my code I'm using:
import onnx
from onnx2keras import onnx_to_keras
onnx_model = onnx.load('model.onnx')
input_all = [node.name for node in onnx_model.graph.input] #get the name of my inputs
k_model = onnx_to_keras(onnx_model, input_all)
Can someone have an idea on how can I resolve this? Thank you!
I would recommend printing all node names to debug this further. To print all, try this.
Also, from this thread, I had success converting a pytorch model -> onnx -> keras using this command:
keras_model = onnx_to_keras(onnx_model, input_names=['input'], name_policy="renumerate")
Setting the name_policy
was crucial to get it working. Might be that you want to do something similar, but I would try printing the node names to see if you are able to extract them. Might be that something went wrong during tfjs -> onnx conversion.