zhiqwang / yolort

yolort is a runtime stack for yolov5 on specialized accelerators such as tensorrt, libtorch, onnxruntime, tvm and ncnn.
https://zhiqwang.com/yolort
GNU General Public License v3.0
708 stars 153 forks source link

Can bbox coordinates be negative in yolo output? #479

Closed YoungjaeDev closed 1 year ago

YoungjaeDev commented 1 year ago

https://github.com/zhiqwang/yolov5-rt-stack/blob/b7cb695beacec273ea97cc0e3732797580ef37b5/deployment/tensorrt/main.cpp#L420-L423

Can the yolo output x coordinates (detection_boxes[4 * i]) be negative -0.0xxxx?

zhiqwang commented 1 year ago

Yes, I think it's possible, it depands on the inference results of YOLOv5 models. We didn't filter out the negative coordinates manually.

YoungjaeDev commented 1 year ago

Yes, I think it's possible, it depands on the inference results of YOLOv5 models.

In the experiment, the box.x value will have a - value, so there will be no problem if I proceed with clip (n, 0, max), right?

zhiqwang commented 1 year ago

Yep, you can filter out the coordinates outside the actual image resolution according to your needs.

YoungjaeDev commented 1 year ago

@zhiqwang Thank you for your advice

zhiqwang commented 1 year ago

You're welcome and also thank you for your feedback.

In contrast, like some functions in OpenCV, they will automatically do some filtering of the coordinates outside the actual resolution of the image. We may also support similar features in the future.

YoungjaeDev commented 1 year ago

@zhiqwang

https://github.com/zhiqwang/yolov5-rt-stack/blob/b7cb695beacec273ea97cc0e3732797580ef37b5/deployment/tensorrt/main.cpp#L63-L64

In this example, fortunately, you did int casting right away in visualize, so there was no problem. but I'd like you to point this out.