xmba15 / onnx_runtime_cpp

small c++ library to quickly deploy models using onnxruntime
MIT License
327 stars 49 forks source link

运行superglue 中的convert_to_onnx.py 报错如下,不懂怎么解决,求助 #29

Closed XuHao9166 closed 1 year ago

XuHao9166 commented 2 years ago

Loaded SuperGlue model ("indoor" weights) /home/xh/.local/lib/python3.6/site-packages/torch/onnx/utils.py:363: UserWarning: Skipping _decide_input_format -1 warnings.warn("Skipping _decide_input_format\n {}".format(e.args[0])) Traceback (most recent call last): File "convert_to_onnx.py", line 71, in main() File "convert_to_onnx.py", line 55, in main "matching_scores1": {0: "batch_size", 1: "num_keypoints1"}, File "/home/xh/.local/lib/python3.6/site-packages/torch/onnx/init.py", line 320, in export custom_opsets, enable_onnx_checker, use_external_data_format) File "/home/xh/.local/lib/python3.6/site-packages/torch/onnx/utils.py", line 111, in export custom_opsets=custom_opsets, use_external_data_format=use_external_data_format) File "/home/xh/.local/lib/python3.6/site-packages/torch/onnx/utils.py", line 729, in _export dynamic_axes=dynamic_axes) File "/home/xh/.local/lib/python3.6/site-packages/torch/onnx/utils.py", line 493, in _model_to_graph graph, params, torch_out, module = _create_jit_graph(model, args) File "/home/xh/.local/lib/python3.6/site-packages/torch/onnx/utils.py", line 437, in _create_jit_graph graph, torch_out = _trace_and_get_graph_from_model(model, args) File "/home/xh/.local/lib/python3.6/site-packages/torch/onnx/utils.py", line 388, in _trace_and_get_graph_from_model torch.jit._get_trace_graph(model, args, strict=False, _force_outplace=False, _return_inputs_states=True) File "/home/xh/.local/lib/python3.6/site-packages/torch/jit/_trace.py", line 1166, in _get_trace_graph outs = ONNXTracedModule(f, strict, _force_outplace, return_inputs, _return_inputs_states)(*args, kwargs) File "/home/xh/.local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl return forward_call(*input, kwargs) File "/home/xh/.local/lib/python3.6/site-packages/torch/jit/_trace.py", line 132, in forward self._force_outplace, File "/home/xh/.local/lib/python3.6/site-packages/torch/jit/_trace.py", line 118, in wrapper outs.append(self.inner(trace_inputs)) File "/home/xh/.local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl return forward_call(input, kwargs) File "/home/xh/.local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 1090, in _slow_forward result = self.forward(*input, kwargs) TypeError: forward() missing 7 required positional arguments: 'scores0', 'keypoints0', 'descriptors0', 'image1_shape', 'scores1', 'keypoints1', and 'descriptors1'

xmba15 commented 2 years ago

@XuHao9166 Can you describe the steps you did in English please? Basically you need to use the same environment I added in README to generate the onnx models.