hhk7734 / tensorflow-yolov4

YOLOv4 Implemented in Tensorflow 2.
MIT License
136 stars 75 forks source link

bboxes as opencv input #16

Closed vkieboominspark closed 4 years ago

vkieboominspark commented 4 years ago

What do you recommend in using for getting the bboxes/ROI for using with cv2.rectangle() function? So getting the original coordinates from yolo.predict()

hhk7734 commented 4 years ago

I am not sure what you want.

vkieboominspark commented 4 years ago

Sorry, I meant the top left en bottom right corner of the detected bounding boxes as (x,y),(x,y) coordinates on original input image. Hope this clarifies.

hhk7734 commented 4 years ago

You want to draw coordinates as text on the image?

vkieboominspark commented 4 years ago

No the rectangle itself, with the coordinates. And with opencv, so not the inference function.

hhk7734 commented 4 years ago

https://github.com/hhk7734/tensorflow-yolov4/blob/056697a748852f996e9b2f6209e892b4c03e0826/py_src/yolov4/tf/__init__.py#L180-L188

this is a part of yolo.inference, self.predict is yolo.predict

yolo.draw_bboxes draw coordinates as a rectangle.

vkieboominspark commented 4 years ago

Ah I see. The 'convert ratio to lenght' part is where it is converted to the right format. Thank you.

hhk7734 commented 4 years ago

Aha :).

bboxes = yolo.predict()
bboxes == [[center_x_ratio, center_y_ratio, width_ratio, height_ratio, class_id, probability], ...]

If the problem is solved, close the issue.