gpt4 book ai didi

python - SORT Tracker - 参数设置

转载 作者:太空宇宙 更新时间:2023-11-03 20:25:07 26 4
gpt4 key购买 nike

我在足球视频中遇到了一些与 SORT 跟踪器(卡尔曼滤波器和匈牙利算法的组合)与 YOLO v3 相结合相关的问题。正如主论文中也提到的,SORT 在身份切换方面遭受了很多损失(换句话说,即使跟踪对象相同,ID 也会发生变化),而且在没有遮挡的情况下也是如此!我想知道是否可以通过校准参数 max_age (没有 id 分配可以通过的时间)和 max_hits 来(稍微)缓解这个问题。这些参数如何影响最终的跟踪?那么匈牙利语的 IoU 参数呢?非常感谢!

class Sort(object):
def __init__(self,max_age=8,min_hits=3):
"""
Sets key parameters for SORT
"""
self.max_age = max_age
self.min_hits = min_hits
self.trackers = []
self.frame_count = 0

def update(self,dets):
"""
Params:
dets - a numpy array of detections in the format [[x,y,w,h,score],[x,y,w,h,score],...]
Requires: this method must be called once for each frame even with empty detections.
Returns the a similar array, where the last column is the object ID.

NOTE: The number of objects returned may differ from the number of detections provided.
"""

# prevent "too many indices for array" error
if len(dets)==0:
return np.empty((0,5))

self.frame_count += 1
#get predicted locations from existing trackers.
trks = np.zeros((len(self.trackers),5))
to_del = []
ret = []
for t,trk in enumerate(trks):
pos = self.trackers[t].predict()[0]
trk[:] = [pos[0], pos[1], pos[2], pos[3], 0]
if(np.any(np.isnan(pos))):
to_del.append(t)
trks = np.ma.compress_rows(np.ma.masked_invalid(trks))
for t in reversed(to_del):
self.trackers.pop(t)
matched, unmatched_dets, unmatched_trks = associate_detections_to_trackers(dets,trks)

#update matched trackers with assigned detections
for t,trk in enumerate(self.trackers):
if(t not in unmatched_trks):
d = matched[np.where(matched[:,1]==t)[0],0]
trk.update(dets[d,:][0])

#create and initialise new trackers for unmatched detections
for i in unmatched_dets:
trk = KalmanBoxTracker(dets[i,:])
self.trackers.append(trk)
i = len(self.trackers)
for trk in reversed(self.trackers):
d = trk.get_state()[0]
if((trk.time_since_update < 1) and (trk.hit_streak >= self.min_hits or self.frame_count <= self.min_hits)):
ret.append(np.concatenate((d,[trk.id+1])).reshape(1,-1)) # +1 as MOT benchmark requires positive
i -= 1
#remove dead tracklet
if(trk.time_since_update > self.max_age):
self.trackers.pop(i)
if(len(ret)>0):

最佳答案

如果您提高 max_age,您将面临在丢失/离开场景的对象和进入上次看到区域的新对象之间混淆的风险。您应该使用此参数(也许提高一点)并降低卡尔曼的 IOU。这将创建更长、更稳健的跟踪,同时增加不同 ID 合并到一个跟踪中的风险。这种调整对于跟踪器的性能至关重要,并且高度依赖于数据。祝你好运:)

关于python - SORT Tracker - 参数设置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57886239/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com