Add https://youtu.be/uDrn9QZJ2lk and object_counting.py, ai_gym.py updates (#9265)

This commit is contained in:
Muhammad Rizwan Munawar 2024-03-24 22:22:17 +05:00 committed by GitHub
parent 281e07d7e6
commit dcb953bc41
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 39 additions and 11 deletions

View file

@ -80,14 +80,6 @@ class AIGym:
self.keypoints = results[0].keypoints.data
self.annotator = Annotator(im0, line_width=2)
num_keypoints = len(results[0])
# Resize self.angle, self.count, and self.stage if the number of keypoints has changed
if len(self.angle) != num_keypoints:
self.angle = [0] * num_keypoints
self.count = [0] * num_keypoints
self.stage = ["-" for _ in range(num_keypoints)]
for ind, k in enumerate(reversed(self.keypoints)):
if self.pose_type in ["pushup", "pullup"]:
self.angle[ind] = self.annotator.estimate_pose_angle(

View file

@ -171,7 +171,7 @@ class ObjectCounter:
# Extract tracks
for box, track_id, cls in zip(boxes, track_ids, clss):
# Draw bounding box
self.annotator.box_label(box, label=f"{track_id}:{self.names[cls]}", color=colors(int(cls), True))
self.annotator.box_label(box, label=f"{track_id}:{self.names[cls]}", color=colors(int(track_id), True))
# Draw Tracks
track_line = self.track_history[track_id]