generated from roboflow/template-python
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1528 from roboflow/feature/make-BaseTrack-count-i…
…nstance-var let ByteTrack to maintain track ID per instance
- Loading branch information
Showing
5 changed files
with
114 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
from typing import List | ||
|
||
import numpy as np | ||
import pytest | ||
|
||
import supervision as sv | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"detections, expected_results", | ||
[ | ||
( | ||
[ | ||
sv.Detections( | ||
xyxy=np.array([[10, 10, 20, 20], [30, 30, 40, 40]]), | ||
class_id=np.array([1, 1]), | ||
confidence=np.array([1, 1]), | ||
), | ||
sv.Detections( | ||
xyxy=np.array([[10, 10, 20, 20], [30, 30, 40, 40]]), | ||
class_id=np.array([1, 1]), | ||
confidence=np.array([1, 1]), | ||
), | ||
], | ||
sv.Detections( | ||
xyxy=np.array([[10, 10, 20, 20], [30, 30, 40, 40]]), | ||
class_id=np.array([1, 1]), | ||
confidence=np.array([1, 1]), | ||
tracker_id=np.array([1, 2]), | ||
), | ||
), | ||
], | ||
) | ||
def test_byte_tracker( | ||
detections: List[sv.Detections], | ||
expected_results: sv.Detections, | ||
) -> None: | ||
byte_tracker = sv.ByteTrack() | ||
tracked_detections = [byte_tracker.update_with_detections(d) for d in detections] | ||
assert tracked_detections[-1] == expected_results |
Leaving a comment for the future. All of these except
_count
are class variables.Resetting these will not impact any instances.