mikel-brostrom / boxmot

BoxMOT: pluggable SOTA tracking modules for segmentation, object detection and pose estimation models
GNU Affero General Public License v3.0
6.74k stars 1.72k forks source link

ocsort_kf breaks with update to dques #1366

Closed johannesgeibel closed 7 months ago

johannesgeibel commented 8 months ago

Search before asking

Yolo Tracking Component

Tracking

Bug

Hi, after the update to deques (10.0.59) OCSORT breaks in KalmanFilter.unfreeze() . First, a deque cannot be slized, breaking this line:

self.history_obs = self.history_obs[:-1]

replacing by _ = self.history_obs.pop() seemed to resolve the issue, but in later frames following error occured:

File "/data/users/johannes.geibel/miniconda3/envs/yolo/lib/python3.11/site-packages/boxmot/motion/kalman_filters/ocsort_kf.py", line 400, in unfreeze
    index1 = indices[-2]
             ~~~~~~~^^^^
IndexError: index -2 is out of bounds for axis 0 with size 1

And I am not really sure where the problem comes from then...

Reverting boxmot to 10.0.57 resolved all issues

Regards, Johannes

Environment

boxmot v. 10.0.59

Minimal Reproducible Example

...

mikel-brostrom commented 8 months ago

https://github.com/mikel-brostrom/yolo_tracking/pull/1367

mikel-brostrom commented 8 months ago

Should be fixed. Let me know 😄

arashrocky commented 8 months ago

Hi @mikel-brostrom. I have faced the same issue. After cloning your newer Release v10.0.60 another problem has emerged, as follows:

File "/home/arash/TAD/ObjectTrack/Yolov8_mikel-brostrom/yolo_tracking/boxmot/motion/kalman_filters/deepocsort_kf.py", line 506, in update self.history_obs.append(z) AttributeError: 'NoneType' object has no attribute 'append'

yflin1 commented 8 months ago

Hi @mikel-brostrom. I have faced the same issue. After cloning your newer Release v10.0.60 another problem has emerged, as follows:

File "/home/arash/TAD/ObjectTrack/Yolov8_mikel-brostrom/yolo_tracking/boxmot/motion/kalman_filters/deepocsort_kf.py", line 506, in update self.history_obs.append(z) AttributeError: 'NoneType' object has no attribute 'append'

Me too.

mikel-brostrom commented 8 months ago

Oh, I missed to replace the last indexing in DeepOCSORT KF

mikel-brostrom commented 8 months ago

Try again please 😄

yflin1 commented 8 months ago

Try again please 😄

Great! The problem is solved. Thank you very much!

mikel-brostrom commented 8 months ago

This:

File "/data/users/johannes.geibel/miniconda3/envs/yolo/lib/python3.11/site-packages/boxmot/motion/kalman_filters/ocsort_kf.py", line 400, in unfreeze index1 = indices[-2]


IndexError: index -2 is out of bounds for axis 0 with size 1

Should be now fixed as well @johannesgeibel

arashrocky commented 7 months ago

Try again please 😄

Thanks mikel. It works fine, but I recommend those who face similar issue to remove the environment and redefine all packages and dependencies again in new environment. This will avoid confusions.

johannesgeibel commented 7 months ago

This:

File "/data/users/johannes.geibel/miniconda3/envs/yolo/lib/python3.11/site-packages/boxmot/motion/kalman_filters/ocsort_kf.py", line 400, in unfreeze index1 = indices[-2]


IndexError: index -2 is out of bounds for axis 0 with size 1

Should be now fixed as well @johannesgeibel

@mikel-brostrom Sadly not... I printed new_history, occur, and indices when the error occurs:

[None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, array([[7.94601074e+02],
       [8.38841797e+02],
       [2.67891208e+04],
       [6.00677161e-01]])]
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]
[49]

The reason is that there is only observation 50 not None and thus len(indices) == 1, causing the error. Could this be due to the dques being fixed at length 50, and I do not have observations over a longer time period (while max_age being set to 50 as well? When I reduced max_age to 30, the error did not occur at this frame anymore. I am not sure where the need for the maximum length of 50 for the history observations comes from, besides probably memory efficiency. But wouldn't it be a possibility, to set the length to max_age + x, ensuring that it is always long enougth?

mikel-brostrom commented 7 months ago

Your are right. The max_age parameter cannot be longer than the history

mikel-brostrom commented 7 months ago

Could this be due to the dques being fixed at length 50, and I do not have observations over a longer time period (while max_age being set to 50 as well?

Aha, that is why I couldn't find this bug 🤣. In the repo max_age is set to 30. I think an assertion here would be enough

ch3ny1 commented 7 months ago

The same bug File "/media/chenyi/Elements/Tools/yolo_tracking-master/boxmot/motion/kalman_filters/hybridsort_kf.py", line 399, in unfreeze index1 = indices[-2] IndexError: index -2 is out of bounds for axis 0 with size 1 is happening to HybridSORT, though the line seems to have been updated according to previous comments self.history_obs = deque(list(self.history_obs)[:-1]).

Any idea on how to solve this bug?

mikel-brostrom commented 7 months ago

This was updated in the last release @ch3ny1. Check out master

TSLNIHAOGIT commented 7 months ago

This was updated in the last release @ch3ny1. Check out master The bug is still there,when i run the last release code!

ile "/mnt/e/python_project_new/yolo_tracking-10.0.65/boxmot/utils/init.py", line 79, in wrapper tracks = self.update(instance, dets, im) File "/mnt/e/python_project_new/yolo_tracking-10.0.65/boxmot/trackers/hybridsort/hybridsort.py", line 469, in update self.active_tracks[m[1]].update(dets[m[0], :], dets0[m[0], 5], dets0[m[0], 6], id_feature_keep[m[0], :]) File "/mnt/e/python_project_new/yolo_tracking-10.0.65/boxmot/trackers/hybridsort/hybridsort.py", line 286, in update self.kf.update(convert_bbox_to_z(bbox)) File "/mnt/e/python_project_new/yolo_tracking-10.0.65/boxmot/motion/kalman_filters/hybridsort_kf.py", line 487, in update self.unfreeze() File "/mnt/e/python_project_new/yolo_tracking-10.0.65/boxmot/motion/kalman_filters/hybridsort_kf.py", line 399, in unfreeze index1 = indices[-2] IndexError: index -2 is out of bounds for axis 0 with size 1

mikel-brostrom commented 7 months ago

What have you set max_age to? @TSLNIHAOGIT

liamwebsterxyz commented 6 months ago

I have tried max_age == 10, 20 and 30 and the same traceback

chensonglu commented 6 months ago

The same bug File "/media/chenyi/Elements/Tools/yolo_tracking-master/boxmot/motion/kalman_filters/hybridsort_kf.py", line 399, in unfreeze index1 = indices[-2] IndexError: index -2 is out of bounds for axis 0 with size 1 is happening to HybridSORT, though the line seems to have been updated according to previous comments self.history_obs = deque(list(self.history_obs)[:-1]).

Any idea on how to solve this bug?

same problem

DenisN03 commented 5 months ago

I faced the same problem. Is there a solution?