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

ONNX support #38

Open
SakshamSinha opened this issue Jun 9, 2020 · 0 comments
Open

ONNX support #38

SakshamSinha opened this issue Jun 9, 2020 · 0 comments

Comments

@SakshamSinha
Copy link

This repository is a great work. Thank you for your work.

I was wondering if you can add ONNX support to your model. Currently, your model gives following error while exporting to ONNX. I am using resnet50-SSD with VOC dataset format.

Change made to demo.py at line 148 are-
dummy_input = torch.randn(1, 3, 300, 300)
output_names = ["outputs"]
torch.onnx.export(net, dummy_input, "resnet50ssd.onnx", verbose=True, output_names=output_names)

Command used to run demo.py-
python demo.py --cfg ./configs/ssd_res50_voc.yaml --weights ./weights/ssd_res50_epoch_50_300.pth --images ./images --save_folder ./output

Error-
Traceback (most recent call last):
File "demo.py", line 174, in
main()
File "demo.py", line 140, in main
torch.onnx.export(net, dummy_input, "resnet50ssd.onnx", verbose=True, output_names=output_names)
File "/home/testuser/venvs/refpy368shared/lib/python3.6/site-packages/torch/onnx/init.py", line 132, in export
strip_doc_string, dynamic_axes)
File "/home/testuser/venvs/refpy368shared/lib/python3.6/site-packages/torch/onnx/utils.py", line 64, in export
example_outputs=example_outputs, strip_doc_string=strip_doc_string, dynamic_axes=dynamic_axes)
File "/home/testuser/venvs/refpy368shared/lib/python3.6/site-packages/torch/onnx/utils.py", line 329, in _export
_retain_param_name, do_constant_folding)
File "/home/testuser/venvs/refpy368shared/lib/python3.6/site-packages/torch/onnx/utils.py", line 213, in _model_to_graph
graph, torch_out = _trace_and_get_graph_from_model(model, args, training)
File "/home/testuser/venvs/refpy368shared/lib/python3.6/site-packages/torch/onnx/utils.py", line 171, in _trace_and_get_graph_from_model
trace, torch_out = torch.jit.get_trace_graph(model, args, _force_outplace=True)
File "/home/testuser/venvs/refpy368shared/lib/python3.6/site-packages/torch/jit/init.py", line 256, in get_trace_graph
return LegacyTracedModule(f, _force_outplace, return_inputs)(*args, **kwargs)
File "/home/testuser/venvs/refpy368shared/lib/python3.6/site-packages/torch/nn/modules/module.py", line 547, in call
result = self.forward(*input, **kwargs)
File "/home/testuser/venvs/refpy368shared/lib/python3.6/site-packages/torch/jit/init.py", line 325, in forward
torch._C._tracer_exit(tuple(out_vars))
RuntimeError: output of traced region did not have observable data dependence with trace inputs; this probably indicates your program cannot be understood by the tracer.

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

1 participant