Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error : model inputs #141

Open
elYeodeol opened this issue Apr 13, 2022 · 1 comment
Open

Error : model inputs #141

elYeodeol opened this issue Apr 13, 2022 · 1 comment

Comments

@elYeodeol
Copy link

elYeodeol commented Apr 13, 2022

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:
image

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!

@andreped
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants