import cv2
import numpy as np
from ultralytics import YOLO
# 加载预训练的 YOLOv8-Pose 模型
model = YOLO('yolov8n-pose.pt')
def detect_fall(frame):
# 进行姿态估计
results = model(frame)
# 遍历检测到的人体
for result in results:
if result.keypoints is not None and len(result.keypoints) > 0:
keypoints = result.keypoints.data.cpu().numpy()
for kpts in keypoints:
# 检查关键点数组是否为空
if len(kpts) > 0:
# 提取关键点
nose = kpts[0]
neck = kpts[1]
&

最低0.47元/天 解锁文章
1063

被折叠的 条评论
为什么被折叠?



