PyTorch-Onnx-Tensorrt icon indicating copy to clipboard operation
PyTorch-Onnx-Tensorrt copied to clipboard

predict error

Open qgh1223 opened this issue 5 years ago • 10 comments

2020-02-27 19:03:07.918249437 [W:onnxruntime:, graph.cc:73 MergeShapeInfo] Error merging shape info for output. '106_convolutional' source:{1,18,52,52} target:{1,255,52,52}. Falling back to lenient merge. 2020-02-27 19:03:07.918328307 [W:onnxruntime:, graph.cc:73 MergeShapeInfo] Error merging shape info for output. '094_convolutional' source:{1,18,26,26} target:{1,255,26,26}. Falling back to lenient merge. 2020-02-27 19:03:07.918373737 [W:onnxruntime:, graph.cc:73 MergeShapeInfo] Error merging shape info for output. '082_convolutional' source:{1,18,13,13} target:{1,255,13,13}. Falling back to lenient merge. Why I met this bug?

qgh1223 avatar Feb 27 '20 11:02 qgh1223

And the result without onnx and with onnx is different.Why?

qgh1223 avatar Feb 27 '20 11:02 qgh1223

What is the number of classes on which you are training/testing? Default Yolov3 is trained on 80 classes. 255 = (80 + 5)*3 It seems you are training for only 1 class. 18 = (1 + 5)*3 So in your case, simply replace 255 by 18 and it should work.

Rapternmn avatar Feb 28 '20 07:02 Rapternmn

Please tell me where I should change the config file.

qgh1223 avatar Feb 28 '20 12:02 qgh1223

I know the problem.But the result is a little strange.I get the result like [330, 640, 330, 665].Why?

qgh1223 avatar Feb 28 '20 12:02 qgh1223

The weight should be correct.I get the correct result without using onnx by using detect.py

qgh1223 avatar Feb 28 '20 12:02 qgh1223

I think you should create the ONNX File Again. Make sure :

  1. args.reso is equal to resolution mentioned config file
  2. Change Line 748-750. Update 255 --> 18 (Since you are doing inference on 1 class)

Rapternmn avatar Feb 28 '20 19:02 Rapternmn

My previous comment was regarding updating the create_onnx.py file.

Rapternmn avatar Feb 28 '20 19:02 Rapternmn

I found there is another problem. Layer of type yolo not supported, skipping ONNX node generation. Error in onnx generation.It cause the wrong detection result?How to solve

qgh1223 avatar Feb 29 '20 00:02 qgh1223

Sample Config File?

Rapternmn avatar Feb 29 '20 15:02 Rapternmn

I don't change the config file except the num_classes value.

qgh1223 avatar Feb 29 '20 23:02 qgh1223