matched, unmatched_dets, unmatched_trks = associate_detections_to_trackers(
bbox_xyxyc, trks) // matched , unmatched_dets, unmatched_trks= [[0 5] [1 1]] [] [0 2 3 4]
import numpy as np
matched =np.array([[0, 5],[1 ,1]])
print("np.where(matched[:, 0] == 0)===",np.where(matched[:, 0] == 0))
track_id = matched[np.where(matched[:, 0] == 0)[0], 1] // # np.where返回索引值 matched = [[0 5] [1 1]] [] [0 2 3 4],其中[[0 5] [1 1]] 0代表目标索引,5代表轨迹索引
print("track_id======",track_id)
bbox_xyxyc= np.array([[15, 66 ,59 ,152 ,0.85773 , 0],
[267,168 ,306 , 215, 0.83919 ,24],
[93,190,154,34 , 0.6524 ,26]])
print("bbox_xyxyc shape===",bbox_xyxyc.shape,bbox_xyxyc)
newbox = bbox_xyxyc[:,2:4:] *2
print("newbox 0 s==========",newbox)
newbox[np.where(newbox[:, 0] >306)[0],0] = 420 //重点是np.where的用法
print("newbox===========",newbox)
sort中的associate_detections_to_trackers返回值
于 2022-12-08 18:06:14 首次发布