Spaces:
Sleeping
Sleeping
File size: 421 Bytes
87aa1c0 efc36ce 9c385e8 efc36ce 87aa1c0 | 1 2 3 4 5 6 7 8 9 10 11 12 | def calculate_detection_box_center(detections, image_width: float):
boxes_center = []
boxes_center_ratio = []
for box in detections:
xmin, ymin, xmax, ymax = box.xyxy
xcenter = (xmax + xmin) / 2
ycenter = (ymax + ymin) / 2
boxes_center.append((int(xcenter), int(ycenter)))
boxes_center_ratio.append(xcenter / image_width)
return (boxes_center, boxes_center_ratio)
|