ultralytics 8.2.20 new Analytics class with plotting visuals (#12955)

Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
Muhammad Rizwan Munawar 2024-05-23 19:54:53 +05:00 committed by GitHub
parent 1a4ac2c6ba
commit 03d380d730
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 417 additions and 7 deletions

View file

@ -73,11 +73,11 @@ class AIGym:
self.stage = ["-" for _ in results[0]]
self.keypoints = results[0].keypoints.data
self.annotator = Annotator(im0, line_width=2)
self.annotator = Annotator(im0, line_width=self.tf)
for ind, k in enumerate(reversed(self.keypoints)):
# Estimate angle and draw specific points based on pose type
if self.pose_type in {"pushup", "pullup", "abworkout"}:
if self.pose_type in {"pushup", "pullup", "abworkout", "squat"}:
self.angle[ind] = self.annotator.estimate_pose_angle(
k[int(self.kpts_to_check[0])].cpu(),
k[int(self.kpts_to_check[1])].cpu(),
@ -93,7 +93,7 @@ class AIGym:
self.stage[ind] = "up"
self.count[ind] += 1
elif self.pose_type == "pushup":
elif self.pose_type == "pushup" or self.pose_type == "squat":
if self.angle[ind] > self.poseup_angle:
self.stage[ind] = "up"
if self.angle[ind] < self.posedown_angle and self.stage[ind] == "up":