Skip to content

⚡️ Speed up function sub_tracks by 69% #61

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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions supervision/tracker/byte_tracker/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,13 +352,10 @@ def sub_tracks(track_list_a: List[STrack], track_list_b: List[STrack]) -> List[i
Returns:
List of remaining tracks from track_list_a after subtraction.
"""
tracks = {track.internal_track_id: track for track in track_list_a}
track_ids_b = {track.internal_track_id for track in track_list_b}

for track_id in track_ids_b:
tracks.pop(track_id, None)

return list(tracks.values())
return [
track for track in track_list_a if track.internal_track_id not in track_ids_b
]


def remove_duplicate_tracks(
Expand Down