cheind / py-motmetrics

:bar_chart: Benchmark multiple object trackers (MOT) in Python
MIT License
1.37k stars 259 forks source link

KeyError while using compare_to_groundtruth #129

Open amitbcp opened 3 years ago

amitbcp commented 3 years ago

Hi,

I am was trying to generate results on MOT16 challenge results and used mm.utils.compare_to_groundtruth to get the accuracy but resulted in error.

df_gt = mm.io.loadtxt('MOT16/preds/MOT16-01/gt/det.txt')
df_test = mm.io.loadtxt('MOT16/preds/MOT16-01/gt/pretrained_pred.txt')
check = mm.utils.compare_to_groundtruth(df_gt, df_test, 'iou', distth=0.5)

ERROR

KeyError                                  Traceback (most recent call last)
<ipython-input-102-df402fdf5fbc> in <module>
      6 
      7 # df_test = mm.io.loadtxt(result)
----> 8 check = mm.utils.compare_to_groundtruth(df_gt, df_test, 'iou', distth=0.5)
      9 

~/opt/anaconda3/lib/python3.7/site-packages/motmetrics/utils.py in compare_to_groundtruth(gt, dt, dist, distfields, distth)
     80         if len(oids) > 0 and len(hids) > 0:
     81             dists = compute_dist(fgt.values, fdt.values)
---> 82         acc.update(oids, hids, dists, frameid=fid)
     83 
     84     return acc

~/opt/anaconda3/lib/python3.7/site-packages/motmetrics/mot.py in update(self, oids, hids, dists, frameid, vf)
    260                 is_switch = (o in self.m and
    261                              self.m[o] != h and
--> 262                              abs(frameid - self.last_occurrence[o]) <= self.max_switch_time)
    263                 cat1 = 'SWITCH' if is_switch else 'MATCH'
    264                 if cat1 == 'SWITCH':

KeyError: -1

pretrained_pred.txt det.txt finetuned_pred.txt

yunseung-dable commented 3 years ago

I have same problem. did you solve?

amitbcp commented 3 years ago

@yunseung-dable I removed a couple of metrics and it worked fine. Was not able to corner out the issue

LingyvKong commented 2 years ago

same problem

tchen0623 commented 1 year ago

Same problem, when the customer ID is some specific number, it will reprot error