MCPcopy Index your code
hub / github.com/FoundationVision/ByteTrack / tracklet

Class tracklet

tutorials/ctracker/test.py:50–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48 return np.array([w, h])
49
50class tracklet:
51 def __init__(self, det_rect):
52 self.id = det_rect.id
53 self.rect_list = [det_rect]
54 self.rect_num = 1
55 self.last_rect = det_rect
56 self.last_frame = det_rect.curr_frame
57 self.no_match_frame = 0
58
59 def add_rect(self, det_rect):
60 self.rect_list.append(det_rect)
61 self.rect_num = self.rect_num + 1
62 self.last_rect = det_rect
63 self.last_frame = det_rect.curr_frame
64
65 @property
66 def velocity(self):
67 if(self.rect_num < 2):
68 return (0, 0)
69 elif(self.rect_num < 6):
70 return (self.rect_list[self.rect_num - 1].position - self.rect_list[self.rect_num - 2].position) / (self.rect_list[self.rect_num - 1].curr_frame - self.rect_list[self.rect_num - 2].curr_frame)
71 else:
72 v1 = (self.rect_list[self.rect_num - 1].position - self.rect_list[self.rect_num - 4].position) / (self.rect_list[self.rect_num - 1].curr_frame - self.rect_list[self.rect_num - 4].curr_frame)
73 v2 = (self.rect_list[self.rect_num - 2].position - self.rect_list[self.rect_num - 5].position) / (self.rect_list[self.rect_num - 2].curr_frame - self.rect_list[self.rect_num - 5].curr_frame)
74 v3 = (self.rect_list[self.rect_num - 3].position - self.rect_list[self.rect_num - 6].position) / (self.rect_list[self.rect_num - 3].curr_frame - self.rect_list[self.rect_num - 6].curr_frame)
75 return (v1 + v2 + v3) / 3
76
77
78def cal_iou(rect1, rect2):

Callers 1

run_each_datasetFunction · 0.85

Calls

no outgoing calls

Tested by 1

run_each_datasetFunction · 0.68