fix Detections.get_data_item() bug (#1061) #1062
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
When I tried to use boolean array indexing to get specific detections from a Detections object, the data field sometimes returned the wrong values (everything is the second value) and sometimes it just didn't work. (See issue #1061)
This is an issue I ran into while trying to simplify ByteTrack.update_with_detections(). Boolean indexing is a feature that is commonly used in general and it would be good to ensure Detections works the same way np.arrays and lists work.
Type of change
How has this change been tested, please provide a testcase or example of how you tested the change?
I tested this with the same test cases from my bug report. Colab notebook
Any specific deployment considerations
For example, documentation changes, usability, usage/costs, secrets, etc.
Docs