@@ -39,18 +39,11 @@ def update(self, output_results, img, ori_img):
39
39
categories = output_results [:, - 1 ]
40
40
41
41
remain_inds = scores > self .args .conf_thresh
42
- inds_low = scores > 0.1
43
- inds_high = scores < self .args .conf_thresh
44
-
45
- inds_second = np .logical_and (inds_low , inds_high )
46
- dets_second = bboxes [inds_second ]
47
42
dets = bboxes [remain_inds ]
48
43
49
44
cates = categories [remain_inds ]
50
- cates_second = categories [inds_second ]
51
45
52
46
scores_keep = scores [remain_inds ]
53
- scores_second = scores [inds_second ]
54
47
55
48
if len (dets ) > 0 :
56
49
'''Detections'''
@@ -68,7 +61,7 @@ def update(self, output_results, img, ori_img):
68
61
else :
69
62
tracked_tracklets .append (track )
70
63
71
- ''' Step 2: First association, with high score detection boxes '''
64
+ ''' Step 2: First association, with small buffer IoU '''
72
65
tracklet_pool = joint_tracklets (tracked_tracklets , self .lost_tracklets )
73
66
74
67
# Predict the current location with Kalman
@@ -89,40 +82,29 @@ def update(self, output_results, img, ori_img):
89
82
track .re_activate (det , self .frame_id , new_id = False )
90
83
refind_tracklets .append (track )
91
84
92
- ''' Step 3: Second association, with low score detection boxes'''
93
- # association the untrack to the low score detections
94
- if len (dets_second ) > 0 :
95
- '''Detections'''
96
- detections_second = [Tracklet_w_bbox_buffer (tlwh , s , cate , motion = self .motion ) for
97
- (tlwh , s , cate ) in zip (dets_second , scores_second , cates_second )]
98
- else :
99
- detections_second = []
100
- r_tracked_tracklets = [tracklet_pool [i ] for i in u_track if tracklet_pool [i ].state == TrackState .Tracked ]
85
+ unmatched_tracklets = [tracklet_pool [i ] for i in u_track if tracklet_pool [i ].state == TrackState .Tracked ]
86
+ unmatched_detections = [detections [i ] for i in u_detection ]
101
87
88
+ '''Step 3: Second association, with large buffer IoU'''
102
89
103
- dists = buffered_iou_distance (r_tracked_tracklets , detections_second , level = 2 )
90
+ dists = buffered_iou_distance (unmatched_tracklets , unmatched_detections , level = 2 )
91
+
92
+ matches , u_track , u_detection = linear_assignment (dists , thresh = 0.5 )
104
93
105
- matches , u_track , u_detection_second = linear_assignment (dists , thresh = 0.5 )
106
94
for itracked , idet in matches :
107
- track = r_tracked_tracklets [itracked ]
108
- det = detections_second [idet ]
95
+ track = unmatched_tracklets [itracked ]
96
+ det = unmatched_detections [idet ]
109
97
if track .state == TrackState .Tracked :
110
98
track .update (det , self .frame_id )
111
99
activated_tracklets .append (track )
112
100
else :
113
101
track .re_activate (det , self .frame_id , new_id = False )
114
102
refind_tracklets .append (track )
115
103
116
- for it in u_track :
117
- track = r_tracked_tracklets [it ]
118
- if not track .state == TrackState .Lost :
119
- track .mark_lost ()
120
- lost_tracklets .append (track )
121
-
122
104
'''Deal with unconfirmed tracks, usually tracks with only one beginning frame'''
123
- detections = [detections [i ] for i in u_detection ]
105
+ detections = [unmatched_detections [i ] for i in u_detection ]
124
106
dists = buffered_iou_distance (unconfirmed , detections , level = 1 )
125
-
107
+
126
108
matches , u_unconfirmed , u_detection = linear_assignment (dists , thresh = 0.7 )
127
109
128
110
for itracked , idet in matches :
@@ -133,15 +115,15 @@ def update(self, output_results, img, ori_img):
133
115
track .mark_removed ()
134
116
removed_tracklets .append (track )
135
117
136
- """ Step 4: Init new tracklets"""
118
+ ''' Step 4. Inital new tracks'''
137
119
for inew in u_detection :
138
120
track = detections [inew ]
139
121
if track .score < self .det_thresh :
140
122
continue
141
123
track .activate (self .frame_id )
142
124
activated_tracklets .append (track )
143
125
144
- """ Step 5: Update state"""
126
+ ''' Step 5: Update state'''
145
127
for track in self .lost_tracklets :
146
128
if self .frame_id - track .end_frame > self .max_time_lost :
147
129
track .mark_removed ()
0 commit comments