系列文章目录
基于yolov8-pose的姿势估计模式,实现站姿,坐姿,伏案睡姿识别,姿态动作识别接口逻辑作参考。本文以学习交流,分享,欢迎留言讨论优化。
yoloPose-姿势动作识别
- 系列文章目录
- 前言
- 一、环境安装
- 二、使用yolov8-pose
-
- 1.导入模型,预测图像
- 三.姿势动作识别之站立
- 总结
前言
算法基础:yolov8-pose:https://docs.ultralytics.com/tasks/pose/
Pose estimation is a task that involves(包含)identifying(认出 )the location of specific points(特定点) in an image, usually referred to as keypoints(关键点). The keypoints can represent(代表) various具有多种特征的parts of the object such as joints(关节), landmarks(地标), or other distinctive (独特)features. The locations of the keypoints are usually represented as a set of 2D [x, y] or 3D [x, y, visible] coordinates坐标.
(模型输出)The output of a pose estimation model is a set of points that represent the keypoints on an object in the image, usually along with the confidence scores (置信度得分)for each point. Pose estimation is a good choice when you need to identify specific parts of an object in a scene, and their location in relation to each other.
YOLOv8 pose models use the -pose suffix(后缀), i.e. yolov8n-pose.pt. These models are trained on the COCO keypoints dataset and are suitable for a variety of pose estimation tasks.
姿势估计是一项涉及识别图像中特定点(通常称为关键点)位置的任务。关键点可以表示对象的各个部分,例如关节、地标或其他独特特征。关键点的位置通常表示为一组2D[x,y]或3D[x,y,visible]坐标。
姿态估计模型的输出是表示图像中对象上的关键点的一组点,通常连同每个点的置信度分数。当您需要识别场景中对象的特定部分以及它们彼此之间的位置时,选择姿势估计。
YOLOv8 pretrained Pose models are shown here.
提示:以下是本篇文章正文内容,下面案例可供参考
一、环境安装
1.安装GPU版pytorch,根据电脑显卡配置选择安装pytorch。
pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu113
pytorch官网或者pytorch 的whl稳定版本下载安装。
2.安装ultraytics
pip install ultralytics
二、使用yolov8-pose
1.导入模型,预测图像
选择yolov8l-pose预训练模型。
接口函数如下:
def testSleepYesNo_withKeypoint(mode_pt=None, source=None):
# device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
kpt_shape: [17, 3] # number of keypoints, number of dims (2 for x,y or 3 for x,y,visible)
flip_idx: [0, 2, 1, 4, 3, 6, 5, 8, 7, 10, 9, 12, 11, 14, 13, 16, 15] # 输出关键点顺序
# 关键点类别索引
kpClasses = ['nose', 'left_eye&#