[ByteTrack] - add a method to reset the state of the tracker#827
Conversation
|
Hi @AdonaiVera 👋🏻 Please drop |
|
I just removed it @SkalskiP |
|
|
||
| return detections | ||
|
|
||
| def reset(self): |
There was a problem hiding this comment.
Can we document this method? For the method to be displayed in docs it needs to be public and have docstring.
There was a problem hiding this comment.
Hi @SkalskiP Thank you for the suggestions. I have already implemented the changes. Please let me know if there is anything else that needs to be updated. 🥷 🚀
|
I tested with your colab. Looks like it works. As I mentioned in the comment, we need a docstring for your newly added method. I also see that pre-commit is complaining about file formatting. |
|
Thank you @AdonaiVera 🙏🏻 Awesome. I tested the solution. Everything works. Let's merge. |
|
Thank you @SkalskiP 🚀 💪 |
Description
This Pull Request introduces a
resetmethod to the ByteTrack tracking system, enabling efficient processing of multiple video streams sequentially within the same execution environment. The enhancement ensures that internal tracking states such astracked_tracks,lost_tracks,removed_tracks, and the globalBaseTrack._countare reset between videos, addressing inaccuracies caused by state persistence.The addition is particularly useful for applications requiring sequential video analysis without the overhead of restarting the Python environment, streamlining workflows in surveillance, traffic monitoring, and activity recognition.
Issue Addressed: #789
Type of Change
Testing
The implementation was tested using a new test case
ultralytics_example_multiple_videos, processing multiple video streams to verify the tracker's state resets correctly. Additionally, a Google Colab demo illustrates the reset functionality in action.output1.mp4
output2.mp4
Deployment Considerations
No specific considerations. The
resetmethod is backward compatible and should seamlessly integrate into existing deployments.Documentation Updates
resetmethod within the ByteTrack class.ultralytics_example_multiple_videostest case documentation to reflect the sequential video processing testing approach.