本博客运行环境为Windows下python3.7的环境。
预先安装好anaconda。
下载tf-pose-estimation-master:https://github.com/ildoonet/tf-pose-estimation
创建虚拟环境进入cmd,创建一个新的python3.7的虚拟环境。env_name是要创建的虚拟环境的名字,x.x是python的版本。
我创建的虚拟环境命名为python37
conda create --name env_name python=x.x
激活虚拟环境
activate python37安装依赖
安装tensorflow
conda install tensorflow-gpu==1.14
安装opencv
pip install opencv-python==3.4.2.17 -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install opencv-contrib-python==3.4.2.17 -i https://pypi.tuna.tsinghua.edu.cn/simple
安装git
官网下载:https://git-scm.com/downloads
一路next,注意把下图这个勾选上然后安装即可。
安装swig
官网下载:http://www.swig.org/download.html
直接解压后,将解压后的路径添加到环境变量中即可。例如我的路径为D:swigwin-4.0.2 ,直接添加到环境变量中。
进入cmd,使用如下代码测试是否安装成功。
swig --help
安装pycocotools
下载:https://github.com/cocodataset/cocoapi
进入cmd , 激活虚拟环境
activate python37
进入到pycocotools的pythonAPI文件夹
cd D:cxycocoapi-masterPythonAPI编译
python setup.py build_ext --inplace
python setup.py build_ext install
完成时如下图所示:
问题1:
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Micros…
解决方案:
下载 Visual Studio , 注意版本是C++ 14.0及以上的才可以。
问题2:
cl: 命令行 error D8021 :无效的数值参数“/Wno-cpp”
error: command ‘C:Program Files (x86)Microsoft Visual Studio2019CommunityVCToolsMSVC14.28.29333binHostX86x64cl.exe’ failed with exit status 2
解决方案:
在cocoapi-masterPythonAPI文件夹中找到setup.py文件。
删除其中的内容:’-Wno-cpp’, '-Wno-unused-function’
然后重新编译即可。
下载tf-pose-estimation-master,网址:https://github.com/ildoonet/tf-pose-estimation
进入tf-pose-estimation-master文件夹:
cd D:cxytf-pose-estimation-master
打开文件夹中的requirements.txt文件可以看到需要下载这些包
编译运行安装这些包
pip3 install -r requirements.txt
如果安装超时,可以到这里去单独下载。
python安装包大全网址:https://www.lfd.uci.edu/~gohlke/pythonlibs/
安装protobuf
conda install protobuf
退出虚拟环境或者新建cmd
编译
swig -python -c++ pafprocess.i && python setup.py build_ext --inplace
python setup.py install
会出现:已完成代码的生成



