Anantha Krishna B commited on
Commit
6fcdab1
·
unverified ·
1 Parent(s): 2c69984

Delete backend/src directory

Browse files
backend/src/main.py DELETED
File without changes
backend/src/utils/post_utils.py DELETED
@@ -1,29 +0,0 @@
1
- import math
2
- from ultralytics import YOLO
3
-
4
- # Load YOLOv8 pose model
5
- def load_model(model_path='yolov8s-pose.pt'):
6
- return YOLO(model_path)
7
-
8
- # Extracts x, y coordinates of a specific keypoint if detected
9
- def get_keypoint_coordinates(results, keypoint_index):
10
- if results[0].keypoints and results[0].keypoints.xy.shape[1] > keypoint_index:
11
- kp_data = results[0].keypoints.xy[0][keypoint_index]
12
- if kp_data.numel() >= 2:
13
- return int(kp_data[0].item()), int(kp_data[1].item())
14
- return None, None
15
-
16
- # Calculates the angle between three points (p2 is the vertex)
17
- def calculate_angle(p1, p2, p3):
18
- if p1 is None or p2 is None or p3 is None:
19
- return None
20
- v1 = (p1[0] - p2[0], p1[1] - p2[1])
21
- v2 = (p3[0] - p2[0], p3[1] - p2[1])
22
- dot_product = v1[0]*v2[0] + v1[1]*v2[1]
23
- mag_v1 = math.sqrt(v1[0]**2 + v1[1]**2)
24
- mag_v2 = math.sqrt(v2[0]**2 + v2[1]**2)
25
- if mag_v1 * mag_v2 == 0:
26
- return None
27
- angle_rad = math.acos(dot_product / (mag_v1 * mag_v2))
28
- angle_deg = math.degrees(angle_rad)
29
- return angle_deg