第一次提交

main
luo 2024-08-14 16:50:07 +08:00
parent d7164ea4d8
commit 7144f48006
2 changed files with 3 additions and 23 deletions

View File

@ -1,3 +1,5 @@
# pose-detect
人员摔倒检测
## 介绍
本项目采用[yolov8](https://github.com/ultralytics/ultralytics)的关键点检测,利用关键点的数据进行预测

22
pose.py
View File

@ -62,21 +62,13 @@ def getAnglebypoint(point_a, point_b, point_c):
def is_fallen(keypoints, boxes):
keypoints = keypoints.cpu().numpy().astype('uint32')
Left_Shoulder = keypoints[5][:2]
# if Left_Shoulder[0] + Left_Shoulder[1] == 0: self.ATHERPOSE += 1
Right_Shoulder = keypoints[6][:2]
# if Right_Shoulder[0] + Right_Shoulder[1] == 0: self.ATHERPOSE += 1
Left_Hip = keypoints[11][:2]
# if Left_Hip[0] + Left_Hip[1] == 0: self.ATHERPOSE += 1
Right_Hip = keypoints[12][:2]
# if Right_Hip[0] + Right_Hip[1] == 0: self.ATHERPOSE += 1
Left_Knee = keypoints[13][:2]
# if Left_Knee[0] + Left_Knee[1] == 0: self.ATHERPOSE += 1
Right_Knee = keypoints[15][:2]
# if Right_Knee[0] + Right_Knee[1] == 0: self.ATHERPOSE += 1
Left_Ankle = keypoints[15][:2]
# if Left_Ankle[0] + Left_Ankle[1] == 0: self.ATHERPOSE += 1
Right_Ankle = keypoints[16][:2]
# if Right_Ankle[0] + Right_Ankle[1] == 0: self.ATHERPOSE += 1
Shoulders_c = [(Left_Shoulder[0] + Right_Shoulder[0]) // 2,
(Left_Shoulder[1] + Right_Shoulder[1]) // 2]
@ -149,20 +141,6 @@ def is_fallen(keypoints, boxes):
if horizontal_threshold < 30:
status_score['Fall'] += 0.6
status_score['Sit'] += -0.15
# if 25 < Hip_Knee_Shoulders_angle < 145 and 75 < human_angle < 125:
# status_score['Sit'] += 0.8
# status_score['Stand'] += -0.035
# if vertical_threshold > 30:
# status_score['Sit'] += +0.15
# _weight = f'{_weight}, [6]Stand:-0.035, Sit:+0.15'
# elif Hip_Knee_Shoulders_angle > 120 and 75 < human_angle < 125:
# status_score['Stand'] += 0.2
# elif Hip_Knee_Shoulders_angle > 120 and -25 < human_angle < 25:
# status_score['Fall'] += 0.2
# else:
# status_score['Fall'] += 0.05
# status_score['Stand'] += 0.05
# _weight = f'{_weight}, [7]Stand:+0.05, Fall:+0.05'
score_max, status_max = max(zip(status_score.values(), status_score.keys()))