Replies: 3 comments 4 replies
-
@jbk3407 hi! 😄 It looks like you're on a great track with using your laptop's webcam for object tracking. If you're interested in tracking specific classes only, such as 'person' or 'phone', you can filter the Here is a modified version of your loop that filters for the 'person' class only: while cap.isOpened():
success, frame = cap.read()
if success:
# Track only 'person' class (class ID for 'person' is 0)
results = model.track(frame, persist=True, classes=[0])
# You can now generate and display the annotated frame as before
annotated_frame = results[0].plot()
cv2.imshow("YOLOv8 Tracking", annotated_frame)
if cv2.waitKey(1) & 0xFF == ord("q"):
break
else:
break
cap.release()
cv2.destroyAllWindows() This code snippet specifies the |
Beta Was this translation helpful? Give feedback.
-
hello,When I use the tracking algorithm, how can I only track a specific id, and other IDs only predict normally without using the tracking algorithm? |
Beta Was this translation helpful? Give feedback.
-
Thank you for your reply. My main code is as follows. How can I specifically track only a specific id while other ids predict normally? Or is there any way for me to set tracking parameters for each ID separately?
|
Beta Was this translation helpful? Give feedback.
-
Hi, I'm trying to track specific class ONLY(ex. 'person', 'phone')using my laptop's webcam.
From the below code I wrote, I'm having hard time figuring out how to use
annotated_frame = results[0].plot()
for tracking only the chosen class.I would like to get a sample code if possible. Thanks in advance :)
Beta Was this translation helpful? Give feedback.
All reactions