for bakeup
This commit is contained in:
@ -286,7 +286,8 @@ def boxing_img(det, img, line_width=3):
|
||||
return imgx
|
||||
|
||||
def draw_tracking_boxes(imgs, tracks, scale=2):
|
||||
'''tracks: [x1, y1, x2, y2, track_id, score, cls, frame_index, box_index]
|
||||
'''需要确保 imgs 覆盖tracks中的帧ID数
|
||||
tracks: [x1, y1, x2, y2, track_id, score, cls, frame_index, box_index]
|
||||
0 1 2 3 4 5 6 7 8
|
||||
关键:
|
||||
(1) imgs中的次序和 track 中的 fid 对应
|
||||
@ -311,12 +312,13 @@ def draw_tracking_boxes(imgs, tracks, scale=2):
|
||||
|
||||
bboxes = array2list(tracks)
|
||||
|
||||
if len(bboxes)!=len(imgs):
|
||||
return []
|
||||
# if len(bboxes)!=len(imgs):
|
||||
# return False, imgs
|
||||
|
||||
subimgs = []
|
||||
for i, boxes in enumerate(bboxes):
|
||||
annotator = Annotator(imgs[i].copy())
|
||||
fid = int(boxes[0, 7])
|
||||
annotator = Annotator(imgs[fid-1].copy())
|
||||
for *xyxy, tid, conf, cls, fid, bid in boxes:
|
||||
label = f'id:{int(tid)}_{int(cls)}_{conf:.2f}'
|
||||
|
||||
@ -331,7 +333,7 @@ def draw_tracking_boxes(imgs, tracks, scale=2):
|
||||
annotator.box_label(pt2, label, color=color)
|
||||
|
||||
img = annotator.result()
|
||||
subimgs.append(img)
|
||||
subimgs.append((fid-1, img))
|
||||
|
||||
return subimgs
|
||||
|
||||
|
Reference in New Issue
Block a user