daddydrac / Dark-Chocolate

Transfer COCO data set annotations to Darknet YOLO annotations format. Hence, Dark(net) Chocolate(COCO)!
BSD 3-Clause "New" or "Revised" License
33 stars 3 forks source link

Fix calculations of output #2

Closed daddydrac closed 4 years ago

daddydrac commented 4 years ago

Math formula that will correct output goes in “darkchocolate” key in JSON, on line 18 in dark_chocolate.py file:

   x_center, y_center = ( left + bbox_width / 2, top + bbox_height / 2)
                    # darknet expects relative values wrt image width & height
                    x_rel, y_rel = (x_center / width, y_center / height)
                    w_rel, h_rel = (bbox_width / width, bbox_height / height)
                    Output: (cat_id, x_rel, y_rel, w_rel, h_rel)