Replies: 2 comments
-
Hi @REZIZ-TER 👋🏻, let me convert this issue into discussion and place it in Q&A section. |
Beta Was this translation helpful? Give feedback.
0 replies
-
@REZIZ-TER the problem is not filtering but the order of operations. In your code, you filter detections and then reassign the Replace this: selected_classes = [0, 1, 2]
detections = sv.Detections.from_ultralytics(result)
detections = detections[np.isin(detections.class_id,selected_classes)]
if result.boxes.id is not None:
detections.tracker_id = result.boxes.id.cpu().numpy().astype(int) With this: selected_classes = [0, 1, 2]
detections = sv.Detections.from_ultralytics(result)
if result.boxes.id is not None:
detections.tracker_id = result.boxes.id.cpu().numpy().astype(int)
detections = detections[np.isin(detections.class_id,selected_classes)] |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Search before asking
Question
My model has 4 classes:
"No Helmet", "Person", "Rider", "Wear a helmet"
I want to filter detections so that only the classes "No Helmet", "Person", "Rider" are detected. How do I edit or add code?
I set selected_classes = [0, 1, 2] to be "No Helmet", "Person", "Rider"
by following the example of Supervision:
and found error
My code below.
Additional
No response
Beta Was this translation helpful? Give feedback.
All reactions