Reference for ultralytics/solutions/ai_gym.py
Note
This file is available at https://github.com/ultralytics/ultralytics/blob/main/ultralytics/solutions/ai_gym.py. If you spot a problem please help fix it by contributing a Pull Request 🛠️. Thank you 🙏!
ultralytics.solutions.ai_gym.AIGym
AIGym(kpts_to_check, line_thickness=2, view_img=False, pose_up_angle=145.0, pose_down_angle=90.0, pose_type='pullup')
A class to manage the gym steps of people in a real-time video stream based on their poses.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
kpts_to_check |
list
|
Indices of keypoints to check. |
required |
line_thickness |
int
|
Thickness of the lines drawn. Defaults to 2. |
2
|
view_img |
bool
|
Flag to display the image. Defaults to False. |
False
|
pose_up_angle |
float
|
Angle threshold for the 'up' pose. Defaults to 145.0. |
145.0
|
pose_down_angle |
float
|
Angle threshold for the 'down' pose. Defaults to 90.0. |
90.0
|
pose_type |
str
|
Type of pose to detect ('pullup', 'pushup', 'abworkout'). Defaults to "pullup". |
'pullup'
|
Source code in ultralytics/solutions/ai_gym.py
start_counting
Function used to count the gym steps.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
im0 |
ndarray
|
Current frame from the video stream. |
required |
results |
list
|
Pose estimation data. |
required |