mikel-brostrom/boxmot

Tiled inference with StrongSort yolo.track method

Asmlatg opened this issue · 3 comments

Search before asking

  • I have searched the Yolo Tracking issues and found no similar bug report.

Question

Hello, I understand that the architecture of StrongSORT is different from all other trackers (it doesn't have a self.observation like the base class 'BaseTracker'). That's why I'm currently attempting to use YOLO's track method (as it is lightweight compared to directly invoking YOLO and calling prediction methods like it's done in 'Tiled inference'). However, I can't seem to figure out how the IDs are returned from the tracker. Should I call the update method using the correct elements from the variable r in the results (in track.py) and then use the outputs returned by the StrongSORT.update method? Or is it included in the yolo.track method?

Just follow the tiled inference examples under README 😄

I did but using yolo.track provided a lightweight result compared to using yolo.predict (like in tiled inference example). So, I wanted to utilize it instead of yolo.predict. Would taking the IDs returned by yolo.track suffice? I attempted to extract the IDs using id = r.boxes.id.cpu().numpy(), but encountered an error.

video 1/1 (11/3766)..: 384x640 10 cars, 74.6ms
strong sort called
[ 1 2 3 4 5 6 7 8 9 10]
video 1/1 (12/3766) .. 384x640 10 cars, 64.8ms
strong sort called
[ 1 2 3 4 5 6 7 8 9 10 11 12]
video 1/1 (13/3766) ...: 384x640 11 cars, 1 truck, 67.3ms
strong sort called
Traceback (most recent call last):
File "tracking/track.py", line 237, in
run(opt)
File "../lib/python3.8/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "tracking/track.py", line 159, in run
for r in results:
File "../lib/python3.8/site-packages/torch/utils/_contextlib.py", line 56, in generator_context
response = gen.send(request)
File "..lib/python3.8/site-packages/ultralytics/engine/predictor.py", line 274, in stream_inference
self.run_callbacks('on_predict_postprocess_end')
File "..lib/python3.8/site-packages/ultralytics/engine/predictor.py", line 377, in run_callbacks
callback(self)
File "../lib/python3.8/site-packages/ultralytics/trackers/track.py", line 64, in on_predict_postprocess_end
predictor.results[i] = predictor.results[i][idx]
File "..lib/python3.8/site-packages/ultralytics/engine/results.py", line 108, in getitem
return self._apply('getitem', idx)
File "..lib/python3.8/site-packages/ultralytics/engine/results.py", line 143, in _apply
setattr(r, k, getattr(v, fn)(*args, **kwargs))
File "../lib/python3.8/site-packages/ultralytics/engine/results.py", line 63, in getitem
return self.class(self.data[idx], self.orig_shape)
IndexError: index 9 is out of bounds for dimension 0 with size 9

👋 Hello, this issue has been automatically marked as stale because it has not had recent activity. Please note it will be closed if no further activity occurs.
Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed!