Skip to content

Commit

Permalink
ultralytics 8.2.100 new YOLOv8-OBB object counting (ultralytics#16437)
Browse files Browse the repository at this point in the history
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
  • Loading branch information
RizwanMunawar and glenn-jocher authored Sep 23, 2024
1 parent b4d544a commit ba94983
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ultralytics/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Ultralytics YOLO 🚀, AGPL-3.0 license

__version__ = "8.2.99"
__version__ = "8.2.100"


import os
Expand Down
11 changes: 7 additions & 4 deletions ultralytics/solutions/object_counter.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,13 @@ def extract_and_process_tracks(self, tracks):
# Draw region or line
annotator.draw_region(reg_pts=self.reg_pts, color=(104, 0, 123), thickness=self.tf * 2)

if tracks[0].boxes.id is not None:
boxes = tracks[0].boxes.xyxy.cpu()
clss = tracks[0].boxes.cls.cpu().tolist()
track_ids = tracks[0].boxes.id.int().cpu().tolist()
# Extract tracks for OBB or object detection
track_data = tracks[0].obb or tracks[0].boxes

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
for box, track_id, cls in zip(boxes, track_ids, clss):
Expand Down

0 comments on commit ba94983

Please sign in to comment.