当前位置: 首页 > news >正文

瑞芯微RV1126B开发板(EASY-EAI-PI2) 人体关键点识别

1. 人体关键点识别简介

人体关键点识别是一种基于深度学习的对人进行检测定位与姿势估计的模型,广泛应用于体育分析、动物行为监测和机器人等领域,帮助机器实时解读物理动作。本算法具有运行效率高、实时性强的特点。

本人员检测算法在数据集表现如下所示:

基于EASY-EAI-PI2(RV1126B)硬件主板的运行效率:

17个人体关键点索引定义:

2. 快速上手

2.1 开发环境准备

如果您初次阅读此文档,请阅读《入门指南/开发环境准备/Easy-Eai编译环境准备与更新》,并按照其相关的操作,进行编译环境的部署

在PC端Ubuntu系统中执行run脚本,进入EASY-EAI编译环境,具体如下所示。

cd ~/develop_environment ./run.sh 2204

2.2 源码下载

在EASY-EAI编译环境下创建存放源码仓库的管理目录:

cd /opt mkdir EASY-EAI-Toolkit cd EASY-EAI-Toolkit

通过git工具,在管理目录内克隆远程仓库

git clone https://github.com/EASY-EAI/EASY-EAI-Toolkit-1126B.git

注:

* 此处可能会因网络原因造成卡顿,请耐心等待。

* 如果实在要在gitHub网页上下载,也要把整个仓库下载下来,不能单独下载本实例对应的目录。

2.3 模型部署

要完成算法Demo的执行,需要先下载人体关键点检测算法模型。

百度网盘链接为:https://pan.baidu.com/s/13BsL5MZ4NQ8jDDe-5WLXDw?pwd=1234(提取码:1234 )。

同时需要把下载的人体关键点检测算法模型复制粘贴到Release/目录:

2.4 例程编译

进入到对应的例程目录执行编译操作,具体命令如下所示:

cd EASY-EAI-Toolkit-1126B/Demos/algorithm-person_pose/ ./build.sh cpres

注:

* 由于依赖库部署在板卡上,因此交叉编译过程中必须保持/mnt挂载。

* 若build.sh脚本带有cpres参数,则会把Release/目录下的所有资源都拷贝到开发板上。

2.5 例程运行及效果

通过串口调试或ssh调试,进入板卡后台,定位到例程部署的位置,如下所示:

cd /userdata/Demo/algorithm-person_pose/

运行例程命令如下所示:

sudo ./test-person_pose person_pose_m.model test.jpg

在EASY-EAI编译环境可以取回测试图片:

cp /mnt/userdata/Demo/algorithm-person_pose/result.jpg .

结果图片如下所示:

API的详细说明,以及API的调用(本例程源码),详细信息见下方说明。

3. 人体关键点检测API说明

3.1 引用方式

为方便客户在本地工程中直接调用我们的EASY EAI api库,此处列出工程中需要链接的库以及头文件等,方便用户直接添加。

3.2 人体关键点识别初始化函数

人体关键点识别初始化函数原型如下所示。

int person_pose_init(const char *c, person_pose_context_t *p_person_pose, int cls_num)

具体介绍如下所示。

3.3 人体关键点识别运行函数

人体关键点识别运行函数person_pose_run原型如下所示。

std::vector<person_pose_result_t> person_pose_run(cv::Mat image, person_pose_context_t *p_person_pose, float nms_threshold, float conf_threshold);

具体介绍如下所示。

3.4 人体关键点识别释放函数

人体关键点识别释放函数原型如下所示。

int person_pose_release(person_pose_context_t* p_person_pose)

具体介绍如下所示。

4. 人体关键识别算法例程

例程目录为Demos/algorithm-person_pose/test-person_pose.cpp,操作流程如下。

参考例程如下所示。

#include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include "person_pose.h" #include <opencv2/opencv.hpp> // 画线 cv::Mat draw_line(cv::Mat image, float *key1, float *key2, cv::Scalar color) { if (key1[2] > 0.1 && key2[2] > 0.1) { cv::Point pt1(key1[0], key1[1]); cv::Point pt2(key2[0], key2[1]); cv::circle(image, pt1, 2, color, 2); cv::circle(image, pt2, 2, color, 2); cv::line(image, pt1, pt2, color, 2); } return image; } // 绘制结果: // 0鼻子, 1左眼, 2右眼,3左耳,4右耳,5左肩,6右肩,7左肘,8右肘,9左腕,10右腕,11左髋关节,12右髋关节,13左膝,14右膝,15左脚踝,16右脚踝 cv::Mat draw_image(cv::Mat image, std::vector<person_pose_result_t> results) { long unsigned int i =0; for (i = 0; i < results.size(); i++) { // 绘制脸部 image = draw_line(image, results[i].keypoints[0], results[i].keypoints[1], CV_RGB(0, 255, 0)); image = draw_line(image, results[i].keypoints[0], results[i].keypoints[2], CV_RGB(0, 255, 0)); image = draw_line(image, results[i].keypoints[1], results[i].keypoints[3], CV_RGB(0, 255, 0)); image = draw_line(image, results[i].keypoints[2], results[i].keypoints[4], CV_RGB(0, 255, 0)); image = draw_line(image, results[i].keypoints[3], results[i].keypoints[5], CV_RGB(0, 255, 0)); image = draw_line(image, results[i].keypoints[4], results[i].keypoints[6], CV_RGB(0, 255, 0)); // 绘制上半身 image = draw_line(image, results[i].keypoints[5], results[i].keypoints[6], CV_RGB(0, 0, 255)); image = draw_line(image, results[i].keypoints[5], results[i].keypoints[7], CV_RGB(0, 0, 255)); image = draw_line(image, results[i].keypoints[7], results[i].keypoints[9], CV_RGB(0, 0, 255)); image = draw_line(image, results[i].keypoints[6], results[i].keypoints[8], CV_RGB(0, 0, 255)); image = draw_line(image, results[i].keypoints[8], results[i].keypoints[10], CV_RGB(0, 0, 255)); image = draw_line(image, results[i].keypoints[5], results[i].keypoints[11], CV_RGB(0, 0, 255)); image = draw_line(image, results[i].keypoints[6], results[i].keypoints[12], CV_RGB(0, 0, 255)); image = draw_line(image, results[i].keypoints[11], results[i].keypoints[12], CV_RGB(0, 0, 255)); // 绘制下半身 image = draw_line(image, results[i].keypoints[11], results[i].keypoints[13], CV_RGB(255, 255, 0)); image = draw_line(image, results[i].keypoints[13], results[i].keypoints[15], CV_RGB(255, 255, 0)); image = draw_line(image, results[i].keypoints[12], results[i].keypoints[14], CV_RGB(255, 255, 0)); image = draw_line(image, results[i].keypoints[14], results[i].keypoints[16], CV_RGB(255, 255, 0)); cv::Rect rect(results[i].left, results[i].top, (results[i].right - results[i].left), (results[i].bottom - results[i].top)); cv::rectangle(image, rect, CV_RGB(255, 0, 0), 2); } return image; } /// 主函数 int main(int argc, char **argv) { if (argc != 3) { printf("%s <model_path> <image_path>\n", argv[0]); return -1; } const char *p_model_path = argv[1]; const char *p_img_path = argv[2]; printf("Model path = %s, image path = %s\n\n", p_model_path, p_img_path); cv::Mat image = cv::imread(p_img_path); printf("Image size = (%d, %d)\n", image.rows, image.cols); int ret; person_pose_context_t yolo11_pose; memset(&yolo11_pose, 0, sizeof(yolo11_pose)); person_pose_init(p_model_path, &yolo11_pose, 1); double start_time = static_cast<double>(cv::getTickCount()); std::vector<person_pose_result_t> results = person_pose_run(image, &yolo11_pose, 0.35, 0.35); double end_time = static_cast<double>(cv::getTickCount()); double time_elapsed = (end_time - start_time) / cv::getTickFrequency() * 1000; std::cout << "person pose run time: " << time_elapsed << " ms" << std::endl; // 绘制结果 image = draw_image(image, results); cv::imwrite("result.jpg", image); printf("Detect size = %ld\n", results.size()); ret = person_pose_release(&yolo11_pose); return ret; }
http://www.cnnetsun.cn/news/3216713.html

相关文章:

  • B站视频秒变AI知识库:免费插件实现高效技术学习
  • 如何用Barlow字体为你的设计项目注入加州公路美学?
  • ARISTO Hand的远端过伸与刚柔传感协同机制解析
  • STM32G0B1RE与TPIS1S1385实现高精度人体存在检测方案
  • 终极数据恢复指南:如何使用TestDisk和PhotoRec找回丢失的分区和文件
  • DeepEval终极指南:3个技巧快速识别AI内容矛盾,提升文本一致性检测准确率
  • 循环经济再定调:一场从“扔掉”到“重生”的深刻革命
  • Simple Live跨平台直播聚合应用:告别频繁切换的终极解决方案
  • 新会上线!2026年工业工程与智能制造国际学术会议 (ICIEIM 2026)
  • 传统的SEO失效了?如何把微信群聊数据喂给AI,抢占下一代搜索红利
  • 别再跑腿了!无犯罪记录证明翻译线上办理全攻略(附费用与流程)
  • Gaze2Act:眼动引导的视觉语言动作联合建模框架
  • ECP5702+FP7208的RGBWY五路调光方案,不带内置电池,支持PD协议和多档电压输入
  • 标书查重太慢?万息投标查重单机版极速模式上线,纯文本文档秒级比对
  • 【GaussDB集群起不来的时候,我在cm_agent上卡了两个小时】
  • 双线突围!近零碳+绿色工厂,企业如何持续解锁“双碳”红利?
  • 告别RGB软件大战:一个开源工具统一所有设备灯光控制
  • 企业数据平台为什么必须从报表底座升级成AI运行底座?
  • 3分钟掌握Android自动打卡:DailyTask无人值守终极方案
  • 单阶段端到端强化学习实现人形机器人视觉驱动越障
  • 新版湿热加速试验来了!一文读懂GB/T 2423.34-2024元器件 “呼吸冻裂” 测试
  • 3步搞定漫画电子化:Kindle Comic Converter终极指南
  • 汽车零部件行业的质量管理软件有哪些?
  • 晚期癌症只能等?错!这种“绿色疗法”让很多患者重获生机
  • 苏州正规的画册设计公司哪家好
  • ResNet-50 PyTorch 1.13 源码逐行解析:从 BasicBlock 到 Bottleneck 的 3 个关键设计
  • Next.js 动态路由与生活数据分页:无限滚动不是唯一选择
  • 上身秀:让服装电商商家告别“拍图焦虑“
  • git新功能开发分支创建
  • 165、LoRA 微调原理:低秩矩阵分解的数学直觉、Adapter 思想与 HuggingFace PEFT