参考链接
[1] Openpose1.5.0+VS2017+CUDA10+cuDNN7.5+WIN10安装部署教程(C++和Python API).
[2] win10+VS2017+openpose1.5.0+cuda10.0+cudnn7.5(GPU版,实现pythonAPI).
Openpose使用见GitHub官方文档-QuickStart
python 01_body_from_image.py
build\x64\Release\OpenPoseDemo.exe --video examples\media\test.mp4
--face
和--hand
(需要更高配置才能运行)接下来配置ST-GCN运行所需的环境,Anaconda基本的使用方法不再赘述。
conda create --name stgcn python=3.6
python -m pip install --upgrade pip
pip install --upgrade pip
这样的低级错误,导致环境中的pip工具损坏,在升级pip时一定要用python -m命令。pip install -i https://pypi.tuna.tsinghua.edu.cn/simple numpy opencv-python
此处使用清华镜像用conda安装
在PyTorch官网选择如下选项:
其中CUDA 11.2选择11.1即可,得到命令如下
conda install pytorch torchvision torchaudio cudatoolkit=11.1 -c pytorch -c conda-forge
若由于网络问题无法安装pytorch,则可以使用以下方法。
用whl文件单独安装PyTorch
如果打不开链接可以挂梯子
下载链接列表
下载项(pytorch和torchvision必须都安装):
pip install 路径\文件名.whl
进行离线安装。import torch
import torchvision
torch.__version__
torchvision.__version__
print(torch.cuda.is_available())
>>> import torch
>>> a = torch.Tensor([1.])
>>> a.cuda()
tensor([1.], device='cuda:0')
>>> from torch.backends import cudnn
>>> cudnn.is_acceptable(a.cuda())
True
pip install -r requirements.txt
conda install ffmpeg
首先在Anaconda环境(名为stgcn)执行setup.py如下
(stgcn) G:\st-gcn-master\st-gcn\torchlight>python setup.py install
运行demo
python main.py demo_offline --video G:\openpose\examples\media\video.avi --openpose G:\openpose\build\x64\Release
或
python main.py demo_old --video G:\openpose\examples\media\video.avi --openpose G:\openpose\build\x64\Release
其中第一个路径为视频路径,第二个路径为编译后的Openpose的路径。
注:本文运行demo_offline并未成功,显示错误如下:
Can not find Openpose Python API.
Traceback (most recent call last):
File "main.py", line 33, in
p.start()
File "G:\st-gcn-master\st-gcn\processor\demo_offline.py", line 31, in start
video, data_numpy = self.pose_estimation()
TypeError: 'NoneType' object is not iterable
该错误暂未解决,若发现解决方法将来会更新。
文中使用的是demo_old。
python main.py demo_old --video G:\openpose\examples\media\video.avi --openpose G:\openpose\build\x64\Release
命令会报错,需要改成python main.py demo_old --video G:/openpose/examples/media/video.avi --openpose G:/openpose/build/x64/Release
即改为正斜杠,这个错误与源码处理命令行参数字符串的方式有关,撰写本文时作者尚未深究此处代码的更好实现,仅对输入参数做修改。Error occurred on a thread. OpenPose closed all its threads and then propagated the error to the main thread. Error description: Caffe trained model file not found: models\pose/coco/pose_iter_440000.caffemodel.
另:根据https://www.it610.com/article/1304174342661246976.htm所述,对demo_old.py文件做过修改。此修改对程序的影响未知。