(5)OpenPose - Pytorch版用于人体姿态检测、关键点提取、摔倒检测

1.下载OpenPose - Pytorch版源码

github下载地址:https://github.com/Hzzone/pytorch-openpose
权重下载:https://pan.baidu.com/s/1IlkvuSi0ocNckwbnUe7j-g#list/path=%2F&parentPath=%2F
完整版代码下载:https://download.csdn.net/download/yohnyang/86400382

在这里插入图片描述
模型所需环境:
cuda 10.0,cudnn10.0,NVIDIA显卡驱动程序安装,下载链接参考:https://blog.csdn.net/yohnyang/article/details/123958642

完成后在命令行里面输入nvcc -V,查看是否安装好所需要的cuda版本:

nvcc -V

在这里插入图片描述

其中,cudnn版本查看在其安装路径下:我的安装路径是将他们都放在了cuda的路径中,.h中的 840 即是版本
在这里插入图片描述

2.安装环境

conda --version    #检查Anaconda是否安装成功
conda info --envs    #检查目前安装了哪些环境

在这里插入图片描述
创建环境并激活安装所需要的包

conda create --name OpenPose python=3.8    #env_name-环境名字

在这里插入图片描述
进入环境

//
conda activate OpenPose

在这里插入图片描述
安装Python包,cmd依次下载…,下载慢可自行搜索如何添加国内源(如清华源)

pip install numpy 
pip install matplotlib 
pip install opencv-python 
pip install scipy 
pip install scikit-image 
pip install tqdm 
pip install ffmpeg 

#安装命令-------------------------------
pip install numpy matplotlib opencv-python scipy scikit-image tqdm ffmpeg 

下载GPU版本的pytorch 和 torchvision

划重点:为了下载速度快,使用了清华源,但下列命令如何操作,下载结果都是torch - cpu版本!!!

conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch

正确下载命令:(真实可用!!!)
cu102 — cuda 10.2.0

pip install torch==1.8.1+cu102 torchvision==0.9.1+cu102 torchaudio===0.8.1 -f https://download.pytorch.org/whl/torch_stable.html

在这里插入图片描述

也可以离线下载导入包:https://download.pytorch.org/whl/cu113,找到所需要的三个包,分别下载torch、torchvision、torchaudio,不过它们的版本需要对应好
在这里插入图片描述
测试:

(OpenPose) C:\Users\Administrator>python
Python 3.8.13 (default, Mar 28 2022, 06:59:08) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> print(torch.__version__)
1.8.1+cu102
>>> print(torch.cuda.is_available())
True
>>>

3.测试openpose

在./demo.py中做加入代码:

device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
print('Using device:', device)

在这里插入图片描述

t1=cv2.getTickCount()
t2= cv2.getTickCount()
print("body_estimation:",(t2 - t1) / cv2.getTickFrequency())
...
t3= cv2.getTickCount()
print("handDetect:",(t3 - t2) / cv2.getTickFrequency())
print("total:",(t3 - t1) / cv2.getTickFrequency())

在这里插入图片描述

检测效果如下:测试图像视野距离中规中矩,效果很准确了,就是时间有点长…

在这里插入图片描述

而且在后边画图上还进行了一遍检测…
暂时先这样吧,后边再做优化…

在这里插入图片描述

  • 1
    点赞
  • 68
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 5
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

明月醉窗台

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值