Win10+tensorflow+openpose(仅CPU)安装教程

一、电脑配置及安装环境
Win10+AMD显卡
Anaconda3
Python3.6
tensorflow1.9

二、安装步骤
有了以上环境后,
1 打开tf版openpose:
https://github.com/ildoonet/tf-pose-estimation
下载到E盘下的pose estimation文件夹

2 下载swigin-3.0.12 (windows/python版)
下载到pose estimation文件夹下并解压。
打开编辑系统环境变量窗口(直接左下角搜索env即可)->环境变量->双击用户环境变量的path,新增一个E:\pose estimation\swigwin-3.0.12\swigwin-3.0.12

3 进入pose estimation文件夹下,
用git bash 运行pip install -r requirements.txt
【事实表明,用anaconda prompt安装会省力很多】以下是我用git bash 运行pip install -r requirements.txt遇到的坑:

(1)

error: RPC failed; curl 56 OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 10054
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed

解决办法,文件大小的上限设置大点:

 git config --global http.postBuffer  524288000

(2)

assert version > 30, "Tensorpack installation requires setuptools > 30"
AssertionError: Tensorpack installation requires setuptools > 30

根据提示,是因为setuptools版本太低,于是更新:

pip install --ignore-installed --upgrade setuptools 

(3)

fatal: unable to access 'https://github.com/ppwwyyxx/tensorpack.git/': Failed to connect to github.com port 443: Timed out
Command "git clone -q https://github.com/ppwwyyxx/tensorpack.git C:\Users\john\AppData\Local\Temp\pip-wp4o8vs0-build" failed with error code 128 in None

解决办法:把txt文件中git+https://github.com/ppwwyyxx/tensorpack.git的https改成git

(4)

扫描二维码关注公众号,回复: 17090042 查看本文章
Command "python setup.py egg_info" failed with error code 1 in C:\Users\john\AppData\Local\Temp\pip-build-tc_fq_ks\pycocotools\

pip安装软件时出现:Command “python setup.py egg_info” failed with error code 1 in /tmp/pip-build-*(其中×与要安装的软件有关)
比如安装到pip install pyparsing==1.5.7出现以下错误: Command “python setup.py egg_info” failed with error code 1 in /tmp/pip-build-WImLdR/pyparsing/
查了一下是setuptools版本不对,解决方法:

pip install --upgrade --force pip 
pip install setuptools==33.1.1

(5)

fatal: unable to connect to github.com: 

解决方法:git config --global url.“https://”.insteadOf git://

前面几个使用git bash 操作的,报错到昏厥。
于是去睡觉了,第二天用anaconda进行操作…

第二天

(1)在anaconda中输入pip install -r requirements.txt,前面正常进行,运行到pycocotools的时候卡住了,报错情况如下:

Collecting pycocotools
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/96/84/9a07b1095fd8555ba3f3d519517c8743c2554a245f9476e5e39869f948d2/pycocotools-2.0.0.tar.gz (1.5 MB)
    ERROR: Command errored out with exit status 1:
     command: 'f:\anaconda\software\envs\tensorflow\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\john\\AppData\\Local\\Temp\\pip-install-vyh_yo3r\\pycocotools\\setup.py'"'"'; __file__='"'"'C:\\Users\\john\\AppData\\Local\\Temp\\pip-install-vyh_yo3r\\pycocotools\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\john\AppData\Local\Temp\pip-install-vyh_yo3r\pycocotools\pip-egg-info'
         cwd: C:\Users\john\AppData\Local\Temp\pip-install-vyh_yo3r\pycocotools\
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\john\AppData\Local\Temp\pip-install-vyh_yo3r\pycocotools\setup.py", line 2, in <module>
        from Cython.Build import cythonize
    ModuleNotFoundError: No module named 'Cython'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

此时,我打开requirements.txt文件,将pycocotools删除,再运行一次pip install -r requirements.txt, 终于成功了。

接下来,单独安装pycocotools。安装前,首先要了解:

名词解释 COCO 是什么?
Microsoft COCO 是一个标注过的图片数据集,可用以目标检测、分割和描述生成等。Yep, it’s all about MS COCO API…

Pycocotools 是什么?
顾名思义,python api tools of coco…

参考链接:https://www.jianshu.com/p/de455d653301

之后我颤抖地开始安装pycocotools,在anaconda中输入了

pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI

竟然没报错,显示Successfully installed pycocotools-2.0

至此,pip install -r requirements.txt终于安装成功了!

(2) python安装中的Unable to find vcvarsall.bat问题

参考这篇博客后成功解决:
https://www.cnblogs.com/charlieroro/p/8482561.html

(3)No module named 'tensorflow.contrib.tensorrt’

import tensorflow.contrib.tensorrt as trt
ModuleNotFoundError: No module named 'tensorflow.contrib.tensorrt'

参考这篇博客后解决:https://blog.csdn.net/weixin_43249762/article/details/90229224

解决方法:\tf-pose-estimation\tf_pose\estimator第14行import tensorflow.contrib.tensorrt as trt注释掉。

猜你喜欢

转载自blog.csdn.net/qq_41073715/article/details/104976407