-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Add end2end yolov7 onnx export for TensorRT8.0+ and onnxruntime(testing now) #273
Conversation
@WongKinYiu @AlexeyAB And it is also avaiable in my repo : https://github.com/triple-Mu/YOLO-TensorRT8 |
Efficient NMS Plugin included with ONNX has already been merged just a few hours ago. Use --include-nms with export.py |
@philipp-schmidt |
@triple-Mu Thanks! Does your Export and NMS implementation better than the current in the most/all cases? |
The method proposed by this pr adds many options, such as iou threshold and conf threshold. In terms of accuracy, since coco mAP calculation requires a lower conf threshold, this part cannot be customized if the combined method is used. Apart from that, using this pr makes it easier to add new modules like preprocessing and letterbox. In terms of inference speed, I think it is consistent with another pr. |
@triple-Mu Great!
As I understand for coco mAP calculation we can use your Could you please fix merge conflicts and provide Google Colab how to convert model to ONNX / TRT and use these ONNX / TRT models for inference? |
The example is here |
Do you mean that the current implementation in the https://github.com/WongKinYiu/yolov7 main-branch doesn't allow to use ONNXruntime inference in ONNX? |
Sure. I will add an example for onnxruntime |
Now I add two examples notebook There is a slight difference between the two usages because they are two different NMS. |
Does it mean that such (default none) NMS will work only for TRT-inference, but will not work for ONNX-inference? |
Yes! It is a plugin not an onnx op. |
Hi @triple-Mu, I have a few questions with this PR:
What's the actual difference between the two? Can't tell from the code.
What's the meaning of the int value? How do I pick the correct one?
Why does opt.end2end disable any dynamic axis? If I set dynamic axis to what it actually should be here (the previous code is copy pasted from a different model I believe, it makes absolutely no sense to make input x and y dynamic if there is no letterbox preprocess op present):
Any reason to disable this? I will make a PR (or change my current PR #280), so I'm curious if you know there are any blockers with your implementation for dynamic input?
This is very ambiguous now - the include-nms option should have been removed with this PR? |
@philipp-schmidt For those using onnxruntime, in order to achieve the same NMS functionality as https://github.com/WongKinYiu/yolov7/blob/main/utils/general.py#L677 , I provide For those using TensorRT plugin, Efficient NMS Plugin is a non-agnostic NMS, so we don't need max-wh, set default None will be ok.
Question 2: In order not to add extra options, because too many options are already included. If we set boolean flag
Question 3: Because Beyond that, while TensorRT supports dynamic batch well, for most people, deploying static models is sufficient.
Question 4:
Summary: The reason why this pr conflicts with end2end and dynamic settings is not that dynamic batch is not supported, but that the code modification may be larger. I think as long as your pr is strong enough, yolov7 will not reject you! |
…ng now) (WongKinYiu#273) * Add end2end yolov7 onnx export for TensorRT8.0+ * Add usage in README * Update yolo.py * Update yolo.py * Add tensorrt onnxruntime examples * Add usage in README Co-authored-by: Alexey <[email protected]>
End-to-end object detection has always been a hot topic in this field.
How to send pictures into the network, and get clean output, so that we do not need to do NMS is a problem that developers often discuss.
This pr uses pytorch's symbolic and designs a global NMS for batch. Registering the NMS operater with the network can speed up global detection and reduce data copying.
Image input, result output!
Real end-to-end detection will make yolov7 even greater !
You can get more information in end2end_example.ipynb !