Solov2-TensorRT-CPP icon indicating copy to clipboard operation
Solov2-TensorRT-CPP copied to clipboard

onnx转换失败

Open 1124676457 opened this issue 3 years ago • 2 comments

我发现使用onnx转换后,输出是11个,不是代码里面的三个,而且我用shape 768 1344去转换,直接报错 Traceback (most recent call last): File "onnx_exporter.py", line 231, in check(args, dummy_input, check_onnx=True, check_trt=False) File "onnx_exporter.py", line 126, in check sess = rt.InferenceSession(args.out) File "/home/tao/anaconda3/lib/python3.8/site-packages/onnxruntime/capi/session.py", line 195, in init self._create_inference_session(providers, provider_options) File "/home/tao/anaconda3/lib/python3.8/site-packages/onnxruntime/capi/session.py", line 205, in _create_inference_session sess.initialize_session(providers or [], provider_options or []) onnxruntime.capi.onnxruntime_pybind11_state.Fail: [ONNXRuntimeError] : 1 : FAIL : Node (Concat_637) Op (Concat) [ShapeInferenceError] Can't merge shape info. Both source and target dimension have values but they differ. Source=49 Target=48 Dimension=2

这个是我在single_stage_ins 加了你介绍的代码后出现的,不加就不会报错,但输出就变成10个了,求教

1124676457 avatar Mar 01 '22 05:03 1124676457

@chenjianqu

1124676457 avatar Mar 01 '22 09:03 1124676457

输出11个张量是对的, 因为Solov2采用了FPN架构.所有输出的张量维度为: {1, 128, 12, 12}, {1, 128, 16, 16}, {1, 128, 24, 24}, {1, 128, 36, 36}, {1, 128, 40, 40}, {1, 80, 12, 12}, {1, 80, 16, 16}, {1, 80, 24, 24}, {1, 80, 36, 36}, {1, 80, 40, 40}, {1, 128, 96, 288}, 我的代码里也是这样定义的

chenjianqu avatar May 07 '22 01:05 chenjianqu