-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ByteTrack] - add a method to reset the state of the tracker #827
[ByteTrack] - add a method to reset the state of the tracker #827
Conversation
Hi @AdonaiVera 👋🏻 Please drop |
I just removed it @SkalskiP |
@@ -261,6 +260,13 @@ def callback(frame: np.ndarray, index: int) -> np.ndarray: | |||
|
|||
return detections | |||
|
|||
def reset(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
reset
method 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._count
are 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
reset
method is backward compatible and should seamlessly integrate into existing deployments.Documentation Updates
reset
method within the ByteTrack class.ultralytics_example_multiple_videos
test case documentation to reflect the sequential video processing testing approach.