基于关键点检测的摔倒识别
时间:2025-07-21 | 作者: | 阅读:0该工程基于PaddleDetection实现人员摔倒识别。先通过特定命令预测视频关键点,得到json结果文件和可视化视频;再用source.py中代码判断摔倒,输出摔倒帧对应时间,还会在视频检测框左上角标注结果并保存为output.mp4,示例中检测到78帧摔倒。
基于PaddleDetection的人员摔倒识别
本工程是基于PaddleDetection人员关键点预测的摔倒识别案例
关于PaddleDetection的使用详情请参考github链接?PaddleDetection
1 获取视频关键点预测结果
在PaddleDetection下使用如下命令预测视频结果(相关模型可以从github中model_zoo获取):
python deploy/python/det_keypoint_unite_infer.py --det_model_dir=output_inference/ppyolo_r50vd_dcn_2x_coco/ --keypoint_model_dir=output_inference/hrnet_w32_256x192/ --video_file=./pose_demo/test.mp4 --device=gpu --save_res=True登录后复制
? ? ? ?
预测完成后会在当前目录下得到预测结果json文件:det_keypoint_unite_video_results.json, 即此处使用的kpts_results.json文件.
在output目录下得到预测结果可视化文件:test.mp4, 即此处的video.mp4文件.
2 根据关键点结果判断是否摔倒
执行最下面命令行的命令,对关键点预测结果kpts_results.json做摔倒逻辑的判断,摔倒帧对应时间会打印显示。同时会在视频上对应时间的检测框左上角打印fall_down结果,结果视频保存为output.mp4。
- 逻辑判断代码在source.py文件中
import osimport sysimport cv2import numpy as npimport jsonimport collectionsfrom source import check_fall_down, videovis登录后复制 ? ?In [3]
#1)脚本第一个参数为关键点预测结果json文件jsonf = ”kpts_results.json“with open(jsonf, ”r“) as rf: kpts_data = json.load(rf)print(”all data length: {}“.format(len(kpts_data)))#2)如果需要视频打印摔倒文字,关键点可视化结果文件放在同路径videof = ”video.mp4“#3)读取关键点结果后放入判断文件fallframes = check_fall_down(kpts_data)#4)根据检测的摔倒帧在视频显示videovis(videof, kpts_data, fallframes)登录后复制 ? ? ? ?
all data length: 468fall_down frames: 78time: 5.5s, fall down detectedtime: 6.0s, fall down detectedtime: 6.5s, fall down detectedtime: 7.0s, fall down detectedtime: 7.5s, fall down detectedtime: 8.0s, fall down detectedtime: 8.5s, fall down detectedtime: 9.0s, fall down detectedtime: 9.5s, fall down detectedtime: 10.0s, fall down detectedtime: 10.5s, fall down detectedtime: 11.0s, fall down detectedtime: 11.5s, fall down detectedtime: 12.0s, fall down detectedtime: 12.5s, fall down detectedtime: 18.0s, fall down detectedtime: 18.5s, fall down detectedtime: 19.5s, fall down detectedtime: 20.5s, fall down detectedtime: 21.0s, fall down detectedtime: 21.5s, fall down detectedtime: 23.5s, fall down detectedtime: 25.5s, fall down detectedtime: 26.0s, fall down detectedtime: 29.5s, fall down detectedtime: 30.0s, fall down detectedtime: 32.0s, fall down detectedtime: 32.5s, fall down detectedtime: 33.0s, fall down detectedtime: 35.0s, fall down detectedtime: 35.5s, fall down detectedtime: 36.0s, fall down detectedtime: 38.0s, fall down detectedtime: 38.5s, fall down detectedprint fall down result in video: video.mp4fps: 12, frame_count: 468登录后复制 ? ? ? ?
来源:https://www.php.cn/faq/1420337.html
免责声明:文中图文均来自网络,如有侵权请联系删除,心愿游戏发布此文仅为传递信息,不代表心愿游戏认同其观点或证实其描述。
相关文章
更多-
- nef 格式图片降噪处理用什么工具 效果如何
- 时间:2025-07-29
-
- 邮箱长时间未登录被注销了能恢复吗?
- 时间:2025-07-29
-
- Outlook收件箱邮件不同步怎么办?
- 时间:2025-07-29
-
- 为什么客户端收邮件总是延迟?
- 时间:2025-07-29
-
- 一英寸在磁带宽度中是多少 老式设备规格
- 时间:2025-07-29
-
- 大卡和年龄的关系 不同年龄段热量需求
- 时间:2025-07-29
-
- jif 格式是 gif 的变体吗 现在还常用吗
- 时间:2025-07-29
-
- hdr 格式图片在显示器上能完全显示吗 普通显示器有局限吗
- 时间:2025-07-29
大家都在玩
大家都在看
更多-
- UltraEdit怎么设置自动转换到DOS格式
- 时间:2025-10-13
-
- UltraEdit怎么关闭整字匹配
- 时间:2025-10-13
-
- 三角洲行动简单又好听游戏网名
- 时间:2025-10-13
-
- 抖音定时发布怎么取消?发布作品正确方法是什么?
- 时间:2025-10-13
-
- 小红书怎么注册新的账号?它起号运营怎么做?
- 时间:2025-10-13
-
- 快手评论被删除的原因怎么查?评论被删除有哪些原因?
- 时间:2025-10-13
-
- 不让别人看抖音收藏的音乐怎么弄?收藏的音乐在哪里找到?
- 时间:2025-10-13
-
- 小红书企业号认证流程是什么?企业号认证的条件是什么?
- 时间:2025-10-13