OpenPose的安装

来源:互联网 发布:无法连入emule网络 编辑:程序博客网 时间:2024/06/01 09:13

从网上看到了OpenPose的介绍,感觉是好东西,虽然目前硬件不满足其要求,不能验证。但此次先把安装过程翻译了,以备后用。


OpenPose的安装:


操作系统支持

  • Ubuntu 14 and 16.
  • Windows 8 and 10.
  • Nvidia Jetson TX2,安装指南参见doc/installation_jetson_tx2.md.
  • OpenPose也已经被用到Windows 7,Mac, CentOS,Nvidia Jetson (TK1 and TX1)嵌入式系统上.然而,我们目前不正式支持它们.

硬件要求

  • NVIDIA显卡,至少可用1.6 GB (Ubuntu上用命令nvidia-smi检测可用GPU内存).
  • 至少2 GB内存.
  • 推荐cuDNN及至少一个8核的CPU.

注意:这些需求认为是缺省配置(--net_resolution "656x368" andscale_number 1).你可能需要更多 (with a greater netresolution and/or number of scales)或更少的资源 (with smaller netresolution and/or using the MPI and MPI_4 models).


下载更新资源库

第一步是下载OpenPose.它可能被放到windowsUbuntu终端的GitHub Desktop:

git clonehttps://github.com/CMU-Perceptual-Computing-Lab/openpose

OpenPose能容易被更新,通过点击windowsGitHub Desktop右上角的synchronization按钮,或在Ubuntu里运行git pull origin master.OpenPose下载后,在你的操作系统上仅运行描述为Reinstallation的部分.

---------------------

Ubuntu

安装 - CMake

推荐的安装方法.比较简单且提供了更多定制化的设置.参见doc/installation_cmake.md.注意这是beta版本,如果失败的话,请进到GitHub里,同时用Installation - Script Compilation .


前提

CUDA,cuDNN, OpenCVAtlas必须已经安装在你的机器上:

1. [CUDA](https://developer.nvidia.com/cuda-80-ga2-download-archive)必须被安装.在安装CUDA后你应该重启你的机器.

2. [cuDNN](https://developer.nvidia.com/cudnn):一旦你已经下载它了,就解压它,拷贝(merge)这个内容到CUDA文件夹,`/usr/local/cuda-8.0/`.:我们发现在cuDNN 5.1OpenPose运行~10%比在cuDNN 6上更快.否则,检查[Compiling without cuDNN](#compiling-without-cudnn).

3. OpenCV`apt-get install libopencv-dev`安装.如果你自己已经编译OpenCV 3,参照[Manual Compilation](#manual-compilation). Makefile.config文件被生成后,编辑他们并删掉注释行`# OPENCV_VERSION := 3`.或者你可以修改所有`Makefile.config.UbuntuXX`文件并运行step2的脚本.

4.另外, OpenCV 3默认不包含`opencv_contrib`模块.如果你有带contrib模块的OpenCV 3 并你想用它,`Makefile`文件里的`LIBRARIES += opencv_core opencv_highgui opencv_imgproc`这行之后插入`opencv_contrib`.

5. Atlas`sudo apt-get install libatlas-base-dev`安装.替代Atlas的话,你能通过修改这行`BLAS := atlas`来用OpenBLASIntel MKL.


安装- ScriptCompilation

构建Caffe & OpenPose库,下载Ubuntu 14.04 or 16.04所需要的Caffe模块(脚本自动检测)以及CUDA 8:

bash ./ubuntu/install_caffe_and_openpose_if_cuda8.sh


重要:这个脚本仅在CUDA 8Ubuntu 14 or 16上运行.否则参见doc/installation_cmake.mdInstallation - Manual Compilation.


安装- ManualCompilation

选用脚本安装,如果你想用CUDA 7,避免用sh脚本,修改一些配置标签(OpenCV版本),然后:

  1. 安装Caffe prerequisites.
  2. 编译CaffeOpenPose,运行如下命令行:

3. ### Install Caffe ###

4. cd 3rdparty/caffe/

5. # Select your desired Makefile file(run only one of the next 4 commands)

6. cpMakefile.config.Ubuntu14_cuda7.example Makefile.config # Ubuntu 14, cuda 7

7. cpMakefile.config.Ubuntu14_cuda8.example Makefile.config # Ubuntu 14, cuda 8

8. cpMakefile.config.Ubuntu16_cuda7.example Makefile.config # Ubuntu 16, cuda 7

9. cp Makefile.config.Ubuntu16_cuda8.exampleMakefile.config # Ubuntu 16, cuda 8

10.# Change any custom flag from theresulting Makefile.config (e.g. OpenCV 3, Atlas/OpenBLAS/MKL, etc.)

11.# Compile Caffe

12.make all -j${number_of_cpus}&& make distribute -j${number_of_cpus}

13. 

14.### Install OpenPose ###

15.cd ../../models/

16.bash ./getModels.sh # It justdownloads the Caffe trained models

17.cd ..

18.# Same file cp command as the oneused for Caffe

19.cpubuntu/Makefile.config.Ubuntu14_cuda7.example Makefile.config

20.# Change any custom flag from theresulting Makefile.config (e.g. OpenCV 3, Atlas/OpenBLAS/MKL, etc.)

21.make all -j${number_of_cpus}


注意:如果你想用你自己的分布式Caffe,按照如下在Custom Caffe部分的步骤,之后重编译OpenPose:

bash ./install_openpose_if_cuda8.sh

注意:这些步骤仅需执行一次.如果你感兴趣对OpenPose库去做些改变,你能简单的编译它:

make clean

make all -j$(NUM_CORES)


非常重要:2Makefile.config.Ubuntu##.example相似文件,一个在主文件下,另一个在3rdparty/caffe/,相当于OpenPoseCaffe的配置文件.任何修改必须2个文件同时改 (OpenCV 3 flag, Atlab/OpenBLAS/MKL flag,).如对CUDA 8 and Ubuntu16:3rdparty/caffe/Makefile.config.Ubuntu16_cuda8.example以及ubuntu/Makefile.config.Ubuntu16_cuda8.example.

重安装

如果你更新一些软件(所用的我们的库或第三方库),或者你简单想重装下它:

  1. 清空OpenPoseCaffe编译文件夹:

      make clean && cd 3rdparty/caffe && make clean

  1. 重复Installation步骤.你不需要再下载这些模块了.

卸载

你仅需要删除OpenPose文件夹,rm -rf openpose/.


-----------------------------

Windows

安装- Demo

  1. 下载并解压portable OpenPose demo 1.0.1.

安装- Library

  1. 安装的前提要求:
    1. Microsoft VS2015 Enterprise Update 3. VS2017 Community不支持, VS 2015 Community没被测试过.
    2. CUDA 8:安装到缺省位置,C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0.否则,相应的修改Visual Studio project solution.VS2015被安装后,安装CUDA 8.0,确保CUDA安装生成对VS的所有必要文件.如果CUDA已经被安装了,在安装VS后重安装CUDA!
    3. cuDNN 5.1:一旦你已经下载它,就解压拷贝(merge)其内容到CUDA文件夹,C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0.
  2. 下载OpenPose依赖和模块 (body, face and hand models),即双击{openpose_path}\windows\download_3rdparty_and_models.bat.相当于,你可以手动下载它们:
    • 模块:
      • COCO model: download inmodels/pose/coco/.
      • MPI model: download inmodels/pose/mpi/.
      • Face model: download inmodels/face/.
      • Hands model: download inmodels/hand/.
    • 依赖:
      • Caffe: Unzip as 3rdparty/windows/caffe/.
      • Caffe dependencies: Unzip as3rdparty/windows/caffe3rdparty/.
      • OpenCV 3.1: Unzip as3rdparty/windows/opencv/.
  3. 打开VS project sln文件,即双击{openpose_path}\windows\OpenPose.sln.
  4. 为了确认OpenPose在运行,尝试编译执行demo:
    1. 右键OpenPoseDemo -->Set as StartUp Project.
    2. 改为Debug byRelease mode.
    3. F5编译运行.
  5. 如果你有了已经连接的webcam, OpenPose在编译后将自动开始.
  6. 为了从命令行上使用创建的exe文件,你必须:
    1. 拷贝{openpose_folder}\3rdparty\windows\caffe\bin\所有DLLs{openpose_folder}\windows\x64\Release.
    2. 拷贝{openpose_folder}\3rdparty\windows\opencv\x64\vc14\bin\所有DLLs:{openpose_folder}\windows\x64\Release.
    3. 打开cmd (Windows button + X, then A).
    4. 进到OpenPose目录:cd C:\openpose\.
    5. 运行教程命令.
  7. 在默认的images, video or webcam上运行OpenPose,来验证正确安装的OpenPose:doc/quick_start.md#quick-start.

原文:https://github.com/CMU-Perceptual-Computing-Lab/openpose/blob/master/doc/installation.md




原创粉丝点击