MCMOT-ByteTrack icon indicating copy to clipboard operation
MCMOT-ByteTrack copied to clipboard

IndexError in multitracker.py

Open nwoyecid opened this issue 3 years ago • 0 comments

Hi Thank you for this code, but I can see some code errors in https://github.com/CaptainEven/MCMOT-ByteTrack/blob/DarknetCfg/tutorials/fairmot/tracker.py (line 255-274)

In line 258:

dets, inds = mot_decode(hm, wh, reg=reg, ltrb=self.opt.ltrb, K=self.opt.K)

If self.opt.K = 500 for instance, the sizes of dets and inds are 500.

Then in line 263 - 264:

dets = self.post_process(dets, meta)
dets = self.merge_outputs([dets])[1]

The dets are separated and process per class. lets say 4 class, hence the len(dets) == num_classes, but the inds is still 500

Then, in line 266-272:

remain_inds = dets[:, 4] > self.opt.conf_thres
inds_low = dets[:, 4] > 0.2
#inds_low = dets[:, 4] > self.opt.conf_thres
inds_high = dets[:, 4] < self.opt.conf_thres
inds_second = np.logical_and(inds_low, inds_high)
dets_second = dets[inds_second]
id_feature_second = id_feature[inds_second]

These indexes do not match for slicing. IndexError: boolean index did not match indexed array along dimension 0; dimension is 500 but corresponding boolean dimension is 179

The inds_second has length of just one class, not entire detection's id_feature. The id_feature did not go through the class ordering in the post_process as the dets.

I think on line 264 dets = self.merge_outputs([dets])[1] you are selecting only the first class. So objects belonging other classes are not tracked.

nwoyecid avatar Jun 14 '22 10:06 nwoyecid