Skip to content

Commit

Permalink
Merge pull request #875 from mikel-brostrom/fix-trackers-output
Browse files Browse the repository at this point in the history
Fix trackers output
  • Loading branch information
mikel-brostrom committed May 17, 2023
2 parents f8b5b9e + e8d5591 commit 9ebfdc3
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 11 deletions.
1 change: 1 addition & 0 deletions track.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ def run(
# overwrite bbox results with tracker predictions
if predictor.tracker_outputs[i].size != 0:
predictor.results[i].boxes = Boxes(
# xyxy, (track_id), conf, cls
boxes=torch.from_numpy(predictor.tracker_outputs[i]).to(dets.device),
orig_shape=im0.shape[:2], # (height, width)
)
Expand Down
2 changes: 1 addition & 1 deletion trackers/botsort/bot_sort.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,8 +467,8 @@ def update(self, output_results, img):
xyxy = np.squeeze(xyxy, axis=0)
output.extend(xyxy)
output.append(tid)
output.append(t.cls)
output.append(t.score)
output.append(t.cls)
outputs.append(output)

outputs = np.asarray(outputs)
Expand Down
2 changes: 1 addition & 1 deletion trackers/bytetrack/byte_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,8 @@ def update(self, dets, _):
xyxy = np.squeeze(xyxy, axis=0)
output.extend(xyxy)
output.append(tid)
output.append(t.cls)
output.append(t.score)
output.append(t.cls)
outputs.append(output)
outputs = np.asarray(outputs)
return outputs
Expand Down
14 changes: 10 additions & 4 deletions trackers/deepocsort/configs/deepocsort.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
# Trial number: 137
# HOTA, MOTA, IDF1: [55.567]
# Trial number: 0
# HOTA, MOTA, IDF1: [58.899, 45.332, 64.646]
deepocsort:
alpha_fixed_emb: 0.9122881591147693
asso_func: giou
conf_thres: 0.5122620708221085
aw_off: false
aw_param: 0.557644552531807
cmc_off: false
conf_thres: 0.3912975993275593
delta_t: 1
det_thresh: 0
embedding_off: false
inertia: 0.3941737016672115
iou_thresh: 0.22136877277096445
max_age: 50
min_hits: 1
use_byte: false
new_kf_off: false
w_association_emb: 0.8475316645583285
6 changes: 3 additions & 3 deletions trackers/deepocsort/ocsort.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ def update(self, dets, img_numpy, tag='blub'):
d = trk.last_observation[:4]
if (trk.time_since_update < 1) and (trk.hit_streak >= self.min_hits or self.frame_count <= self.min_hits):
# +1 as MOT benchmark requires positive
ret.append(np.concatenate((d, [trk.id + 1], [trk.cls], [trk.conf])).reshape(1, -1))
ret.append(np.concatenate((d, [trk.id + 1], [trk.conf], [trk.cls])).reshape(1, -1))
i -= 1
# remove dead tracklet
if trk.time_since_update > self.max_age:
Expand Down Expand Up @@ -635,7 +635,7 @@ def update_public(self, dets, cates, scores):
if trk.time_since_update < 1:
if (self.frame_count <= self.min_hits) or (trk.hit_streak >= self.min_hits):
# id+1 as MOT benchmark requires positive
ret.append(np.concatenate((d, [trk.id + 1], [trk.cls], [trk.conf])).reshape(1, -1))
ret.append(np.concatenate((d, [trk.id + 1], [trk.conf], [trk.cls])).reshape(1, -1))
if trk.hit_streak == self.min_hits:
# Head Padding (HP): recover the lost steps during initializing the track
for prev_i in range(self.min_hits - 1):
Expand All @@ -646,8 +646,8 @@ def update_public(self, dets, cates, scores):
(
prev_observation[:4],
[trk.id + 1],
[trk.cls],
[trk.conf],
[trk.cls],
)
)
).reshape(1, -1)
Expand Down
2 changes: 1 addition & 1 deletion trackers/ocsort/ocsort.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ def update(self, dets, _):
d = trk.last_observation[:4]
if (trk.time_since_update < 1) and (trk.hit_streak >= self.min_hits or self.frame_count <= self.min_hits):
# +1 as MOT benchmark requires positive
ret.append(np.concatenate((d, [trk.id+1], [trk.cls], [trk.conf])).reshape(1, -1))
ret.append(np.concatenate((d, [trk.id+1], [trk.conf], [trk.cls])).reshape(1, -1))
i -= 1
# remove dead tracklet
if(trk.time_since_update > self.max_age):
Expand Down
2 changes: 1 addition & 1 deletion trackers/strongsort/strong_sort.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def update(self, dets, ori_img):
class_id = track.class_id
conf = track.conf
queue = track.q
outputs.append(np.array([x1, y1, x2, y2, track_id, class_id, conf], dtype=np.float))
outputs.append(np.array([x1, y1, x2, y2, track_id, conf, class_id], dtype=np.float))
outputs = np.asarray(outputs)
return outputs

Expand Down

0 comments on commit 9ebfdc3

Please sign in to comment.