From cf658291daff08c0198c0eaff0830fe70c34ea2e Mon Sep 17 00:00:00 2001 From: sonhun99 <57802358+sonhun99@users.noreply.github.com> Date: Fri, 22 Sep 2023 15:44:42 +0900 Subject: [PATCH] fix center_x, center_y --- detect_and_track.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/detect_and_track.py b/detect_and_track.py index 620fb19..44d0ce6 100644 --- a/detect_and_track.py +++ b/detect_and_track.py @@ -45,9 +45,15 @@ def draw_boxes(img, bbox, identities=None, categories=None, names=None, save_wit txt_str = "" if save_with_object_id: txt_str += "%i %i %f %f %f %f %f %f" % ( - id, cat, int(box[0])/img.shape[1], int(box[1])/img.shape[0] , int(box[2])/img.shape[1], int(box[3])/img.shape[0] ,int(box[0] + (box[2] * 0.5))/img.shape[1] , - int(box[1] + ( - box[3]* 0.5))/img.shape[0]) + id, + cat, + int(box[0]) / img.shape[1], + int(box[1]) / img.shape[0], + int(box[2]) / img.shape[1], + int(box[3]) / img.shape[0], + int(box[0] + box[2]) * 0.5 / img.shape[1], + int(box[1] + box[3]) * 0.5 / img.shape[0], + ) txt_str += "\n" with open(path + '.txt', 'a') as f: f.write(txt_str)