Skip to content

Commit

Permalink
Merge pull request #1062 from rolson24/fix-Detections-call-bug
Browse files Browse the repository at this point in the history
fix Detections.get_data_item() bug (#1061)
  • Loading branch information
SkalskiP committed Mar 28, 2024
2 parents 34b80eb + 29ba24f commit 69563b8
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion supervision/detection/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -845,8 +845,15 @@ def get_data_item(
elif isinstance(value, list):
if isinstance(index, slice):
subset_data[key] = value[index]
elif isinstance(index, (list, np.ndarray)):
elif isinstance(index, list):
subset_data[key] = [value[i] for i in index]
elif isinstance(index, np.ndarray):
if index.dtype == bool:
subset_data[key] = [
value[i] for i, index_value in enumerate(index) if index_value
]
else:
subset_data[key] = [value[i] for i in index]
elif isinstance(index, int):
subset_data[key] = [value[index]]
else:
Expand Down

0 comments on commit 69563b8

Please sign in to comment.