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

onnxruntime推理出错 #4

Open
youwh-PIRI opened this issue May 7, 2020 · 3 comments
Open

onnxruntime推理出错 #4

youwh-PIRI opened this issue May 7, 2020 · 3 comments

Comments

@youwh-PIRI
Copy link

Hello, this error occurred when I was reasoning on onnxruntime. Have you ever encountered it?Thank you very much if you can reply!

onnxruntime.capi.onnxruntime_pybind11_state.InvalidGraph: [ONNXRuntimeError] : 10 : INVALID_GRAPH : Load model from /home/youwh/ywh/efficientDet--ONNX/convert/efficientdet-d1-voc.onnx failed:This is an invalid model. Error in Node: : Node () has input size 1 not in range [min=2, max=3].

@murdockhou
Copy link
Owner

@youwh-PIRI Sorry for not familiar with onnxruntime.

@mychina75
Copy link

mychina75 commented May 8, 2020

yes.
when I try to use onnx-simplifier. The same error occurred.
looks like onnx checker can not accept current model format.
################
python -m onnxsim efficientdet-d1.onnx efficientdet-d1-opt.onnx
Simplifying...
Traceback (most recent call last):
File "/opt/anaconda3/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/opt/anaconda3/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/opt/anaconda3/lib/python3.6/site-packages/onnxsim/main.py", line 48, in
main()
File "/opt/anaconda3/lib/python3.6/site-packages/onnxsim/main.py", line 36, in main
args.input_model, check_n=args.check_n, perform_optimization=not args.skip_optimization, skip_fuse_bn=not args.enable_fuse_bn, input_shapes=input_shapes)
File "/opt/anaconda3/lib/python3.6/site-packages/onnxsim/onnx_simplifier.py", line 301, in simplify
onnx.checker.check_model(model)
File "/opt/anaconda3/lib/python3.6/site-packages/onnx/checker.py", line 91, in check_model
C.check_model(model.SerializeToString())
onnx.onnx_cpp2py_export.checker.ValidationError: Node () has input size 1 not in range [min=2, max=3].

==> Context: Bad node spec: input: "data" output: "1005" op_type: "Pad" attribute { name: "mode" s: "constant" type: STRING } attribute { name: "pads" ints: 0 ints: 0 ints: 0 ints: 0 ints: 0 ints: 0 ints: 1 ints: 1 type: INTS } attribute { name: "value" f: 0 type: FLOAT }

@absorbguo
Copy link

I also came across with the "Invalid Feed" error, here is my solution, before testing with onnxruntime_test, I use onnx optimize the onnx model, after "eliminate_unused_initializer" optimization, the onnxruntime_test passed. Hope this solution is usefull for you.

import onnx
from onnx import optimizer
def opt(original_model):
    op = ["eliminate_unused_initializer"]
    optimized_model = optimizer.optimize(original_model, op)
    onnx.save(optimized_model, "efficientdet-d0-opt.onnx")

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

4 participants