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做推理 #6

Open
dongfangzhizhu opened this issue Feb 19, 2021 · 2 comments
Open

使用onnx做推理 #6

dongfangzhizhu opened this issue Feb 19, 2021 · 2 comments

Comments

@dongfangzhizhu
Copy link

使用export_onnx.py导出的onnx模型做推理,输出的shape为(1, 4, 80, 80, 19),而原模型输出的为[1, 89760, 19],请问下是什么原因造成的呢,或者有没有什么办法保持两者输出一致呢?

@DataXujing
Copy link
Owner

DataXujing commented Mar 1, 2021

如果你用的是TensorRT 7.0及以下的版本,则转onnx时opset_version=10,此时需要按照https://github.com/DataXujing/ScaledYOLOv4/blob/main/models/yolo.py#L16将7个output转为[1,89760,19]维度的tensor,如果你是用的是TensorRT 7.2则在转onnx时opset_version=12,此时是可以正常输出[1,89760,19]维度的tensor的

@dongfangzhizhu
Copy link
Author

感谢回复,export_onnx.py中opset_version默认值已经是12了,我可能没有表述好,如果是onnx输出的,这种shape使用non_max_suppression方法是无法解析正确的,请问如何才能解析为形如(x1, y1, x2, y2, conf, cls)这种结果呢

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

2 participants