ultralytics 8.2.100 new YOLOv8-OBB object counting (#16437)

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
Muhammad Rizwan Munawar 2024-09-24 03:40:05 +05:00 committed by GitHub
parent b4d544a0f9
commit ba949830bf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 5 deletions

View file

@ -1,6 +1,6 @@
# Ultralytics YOLO 🚀, AGPL-3.0 license # Ultralytics YOLO 🚀, AGPL-3.0 license
__version__ = "8.2.99" __version__ = "8.2.100"
import os import os

View file

@ -127,10 +127,13 @@ class ObjectCounter:
# Draw region or line # Draw region or line
annotator.draw_region(reg_pts=self.reg_pts, color=(104, 0, 123), thickness=self.tf * 2) annotator.draw_region(reg_pts=self.reg_pts, color=(104, 0, 123), thickness=self.tf * 2)
if tracks[0].boxes.id is not None: # Extract tracks for OBB or object detection
boxes = tracks[0].boxes.xyxy.cpu() track_data = tracks[0].obb or tracks[0].boxes
clss = tracks[0].boxes.cls.cpu().tolist()
track_ids = tracks[0].boxes.id.int().cpu().tolist() if track_data and track_data.id is not None:
boxes = track_data.xyxy.cpu()
clss = track_data.cls.cpu().tolist()
track_ids = track_data.id.int().cpu().tolist()
# Extract tracks # Extract tracks
for box, track_id, cls in zip(boxes, track_ids, clss): for box, track_id, cls in zip(boxes, track_ids, clss):