ultralytics 8.2.46 Results, DFL and AIGym fixes (#14074)
Co-authored-by: UltralyticsAssistant <web@ultralytics.com> Co-authored-by: AAOMM <52826299+Chayanonjackal@users.noreply.github.com> Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com> Co-authored-by: Muhammad Rizwan Munawar <muhammadrizwanmunawar123@gmail.com> Co-authored-by: zzzer <48149018+zhixuwei@users.noreply.github.com> Co-authored-by: Abirami Vina <abirami.vina@gmail.com>
This commit is contained in:
parent
f5ccddf5df
commit
645c83671f
10 changed files with 28 additions and 26 deletions
|
|
@ -53,24 +53,29 @@ class AIGym:
|
|||
|
||||
# Check if environment supports imshow
|
||||
self.env_check = check_imshow(warn=True)
|
||||
self.count = list()
|
||||
self.angle = list()
|
||||
self.stage = list()
|
||||
|
||||
def start_counting(self, im0, results, frame_count):
|
||||
def start_counting(self, im0, results):
|
||||
"""
|
||||
Function used to count the gym steps.
|
||||
|
||||
Args:
|
||||
im0 (ndarray): Current frame from the video stream.
|
||||
results (list): Pose estimation data.
|
||||
frame_count (int): Current frame count.
|
||||
"""
|
||||
|
||||
self.im0 = im0
|
||||
|
||||
# Initialize count, angle, and stage lists on the first frame
|
||||
if frame_count == 1:
|
||||
self.count = [0] * len(results[0])
|
||||
self.angle = [0] * len(results[0])
|
||||
self.stage = ["-" for _ in results[0]]
|
||||
if not len(results[0]):
|
||||
return self.im0
|
||||
|
||||
if len(results[0]) > len(self.count):
|
||||
new_human = len(results[0]) - len(self.count)
|
||||
self.count += [0] * new_human
|
||||
self.angle += [0] * new_human
|
||||
self.stage += ["-"] * new_human
|
||||
|
||||
self.keypoints = results[0].keypoints.data
|
||||
self.annotator = Annotator(im0, line_width=self.tf)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue