xmba15 / onnx_runtime_cpp

small c++ library to quickly deploy models using onnxruntime

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bug?

intjun opened this issue · comments

commented

Traceback (most recent call last):
File "convert_to_onnx.py", line 71, in
main()
File "convert_to_onnx.py", line 36, in main
torch.onnx.export(
File "/root/anaconda3/envs/eys/lib/python3.8/site-packages/torch/onnx/init.py", line 225, in export
return utils.export(model, args, f, export_params, verbose, training,
File "/root/anaconda3/envs/eys/lib/python3.8/site-packages/torch/onnx/utils.py", line 85, in export
_export(model, args, f, export_params, verbose, training, input_names, output_names,
File "/root/anaconda3/envs/eys/lib/python3.8/site-packages/torch/onnx/utils.py", line 632, in _export
_model_to_graph(model, args, verbose, input_names,
File "/root/anaconda3/envs/eys/lib/python3.8/site-packages/torch/onnx/utils.py", line 409, in _model_to_graph
graph, params, torch_out = _create_jit_graph(model, args,
File "/root/anaconda3/envs/eys/lib/python3.8/site-packages/torch/onnx/utils.py", line 379, in _create_jit_graph
graph, torch_out = _trace_and_get_graph_from_model(model, args)
File "/root/anaconda3/envs/eys/lib/python3.8/site-packages/torch/onnx/utils.py", line 342, in _trace_and_get_graph_from_model
torch.jit._get_trace_graph(model, args, strict=False, _force_outplace=False, _return_inputs_states=True)
File "/root/anaconda3/envs/eys/lib/python3.8/site-packages/torch/jit/_trace.py", line 1148, in _get_trace_graph
outs = ONNXTracedModule(f, strict, _force_outplace, return_inputs, _return_inputs_states)(*args, **kwargs)
File "/root/anaconda3/envs/eys/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "/root/anaconda3/envs/eys/lib/python3.8/site-packages/torch/jit/_trace.py", line 125, in forward
graph, out = torch._C._create_graph_by_tracing(
File "/root/anaconda3/envs/eys/lib/python3.8/site-packages/torch/jit/_trace.py", line 116, in wrapper
outs.append(self.inner(*trace_inputs))
File "/root/anaconda3/envs/eys/lib/python3.8/site-packages/torch/nn/modules/module.py", line 725, in _call_impl
result = self._slow_forward(*input, **kwargs)
File "/root/anaconda3/envs/eys/lib/python3.8/site-packages/torch/nn/modules/module.py", line 709, in _slow_forward
result = self.forward(*input, **kwargs)
TypeError: forward() missing 7 required positional arguments: 'scores0', 'keypoints0', 'descriptors0', 'image1_shape', 'scores1', 'keypoints1', and 'descriptors1'

@intjun I assume you are mentioning the convert script for superglue.
Can you share info about the environments?

I tested the script with

torch: 1.12.0
onnxruntime: 1.12.1
opencv: 4.1.2

Did you install the dependencies with the requirements.txt I mentioned?

commented

OK, I'll try. Thank you very much!

torch 1.11.0
onnxruntime 1.11.1
opencv-python 4.1.2.30

@intjun Have you got it working?
btw, my code did have a bug in nms part. I fixed it and the result for superglue is way better now.

commented

@intjun Have you got it working? btw, my code did have a bug in nms part. I fixed it and the result for superglue is way better now.

yes,i got it work.Thank you very much.But I want to use tensorrt as the back-end of onnx to run superglue. There are some problems and it cannot run. If you have time, please help me. Thanks again!