isarsoft / yolov4-triton-tensorrt

This repository deploys YOLOv4 as an optimized TensorRT engine to Triton Inference Server
http://www.isarsoft.com
Other
276 stars 63 forks source link

mismatch in postprocess func #63

Closed schoenxyx closed 2 years ago

schoenxyx commented 2 years ago

https://github.com/isarsoft/yolov4-triton-tensorrt/blob/b42dd1faf50e516b3943eafd3c15408f536bf1c5/clients/python/processing.py#L131

https://github.com/isarsoft/yolov4-triton-tensorrt/blob/b42dd1faf50e516b3943eafd3c15408f536bf1c5/clients/python/boundingbox.py#L2

Thanks so much for your great repository. I found that there was a mismatch in the arrangement in above lines ( img_h, img_w <> image_width, image_height ).

Maybe I misunderstand something?

Thanks in advance for your help.

philipp-schmidt commented 2 years ago

What do you mean? Are you getting errors that you can share?

schoenxyx commented 2 years ago

Thanks so much for your quick reply.

I'm just wondering that whether the input arrangement of the CLASS BoundingBox is conflicting with the setting in postprocess function.

It seems like the order of image_weight and image_height is just different.

detected_objects.append(BoundingBox(label, score, box[0], box[2], box[1], box[3], img_h, img_w)) <-> def init(self, classID, confidence, x1, x2, y1, y2, image_width, image_height)

img_h, img_w <-> image_width, image_height

schoenxyx commented 2 years ago

What do you mean? Are you getting errors that you can share?

The related methods in BoundingBox class are not used in your examples, so I'm sorry that I'm not able to share errors.

philipp-schmidt commented 2 years ago

The "box" array is coming from the output layers of the network. So that's probably the internal implementation order of the yolo layer in darknet, but it's long ago I implemented this.

You can have a look at the postprocessing internals, there should be comments regarding the order in the NMS function.

philipp-schmidt commented 2 years ago

https://github.com/isarsoft/yolov4-triton-tensorrt/blob/b42dd1faf50e516b3943eafd3c15408f536bf1c5/clients/python/processing.py#L125

philipp-schmidt commented 2 years ago

Oh you mean the order of width and height, I get it now. Well that's easy to change, feel free to PR and make this more consistent.

schoenxyx commented 2 years ago

Thanks so much.

I've checked postprocess func line by line, and maybe this issue is not related to the "box" or outputs. It seems that when you making a detected box in "class BoundingBox" format after nms, the necessary input of this class should be arranged in format [image_width, image_height].

schoenxyx commented 2 years ago

Oh you mean the order of width and height, I get it now. Well that's easy to change, feel free to PR and make this more consistent.

Thanks so much for your confirm. It would be my pleasure to make a little contribution to this repository.

philipp-schmidt commented 2 years ago

Fixed in #64