Skip to content

Commit

Permalink
fixed a bug (#181)
Browse files Browse the repository at this point in the history
Co-authored-by: lihi <[email protected]>
  • Loading branch information
Lihi-Gur-Arie and lihi authored Sep 28, 2023
1 parent 0708b3f commit 22483cb
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions motmetrics/mot.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,19 @@ def update(self, oids, hids, dists, frameid=None, vf=''):

o = oids[i]
h = hids[j]
is_switch = (o in self.m and
self.m[o] != h and
abs(frameid - self.last_occurrence[o]) <= self.max_switch_time)
######################################################################
# todo - fixed a bug:
# is_switch = (o in self.m and
# self.m[o] != h and
# abs(frameid - self.last_occurrence[o]) <= self.max_switch_time)
switch_condition = (
o in self.m and
self.m[o] != h and
o in self.last_occurrence and # Ensure the object ID 'o' is initialized in last_occurrence
abs(frameid - self.last_occurrence[o]) <= self.max_switch_time
)
is_switch = switch_condition
######################################################################
cat1 = 'SWITCH' if is_switch else 'MATCH'
if cat1 == 'SWITCH':
if h not in self.hypHistory:
Expand Down

0 comments on commit 22483cb

Please sign in to comment.