从网上看到了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" and scale_number 1). 你可能需要更多 (with a greater netresolution and/or number of scales) 或更少的资源 (with smaller netresolution and/or using the MPI and MPI_4 models).
下载更新资源库
第一步是下载OpenPose库. 它可能被放到windows和Ubuntu终端的GitHub Desktop:
git clone https://github.com/CMU-Perceptual-Computing-Lab/openpose
OpenPose能容易被更新,通过点击windows的GitHub Desktop右上角的 synchronization按钮, 或在Ubuntu 里运行git pull origin master. 在OpenPose 下载后, 在你的操作系统上仅运行描述为Reinstallation 的部分.
---------------------
Ubuntu
安装 - CMake
推荐的安装方法. 比较简单且提供了更多定制化的设置. 参见 doc/installation_cmake.md. 注意这是beta版本, 如果失败的话, 请进到GitHub里,同时用Installation - Script Compilation .
前提
CUDA,cuDNN, OpenCV 及Atlas必须已经安装在你的机器上:
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.1上OpenPose运行~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`来用OpenBLAS 或Intel MKL.
安装- ScriptCompilation
构建Caffe & OpenPose 库,下载Ubuntu 14.04 or 16.04所需要的Caffe模块(脚本自动检测) 以及CUDA 8:
bash ./ubuntu/install_caffe_and_openpose_if_cuda8.sh
重要: 这个脚本仅在CUDA 8 及Ubuntu 14 or 16上运行. 否则参见 doc/installation_cmake.md 或 Installation - Manual Compilation.
安装- ManualCompilation
选用脚本安装, 如果你想用CUDA 7, 避免用sh 脚本, 修改一些配置标签(如OpenCV 版本) 等, 然后:
- 安装Caffe prerequisites.
- 编译Caffe及OpenPose, 运行如下命令行:
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)
非常重要: 有2个Makefile.config.Ubuntu##.example 相似文件, 一个在主文件下,另一个在3rdparty/caffe/下, 相当于OpenPose 与Caffe 的配置文件. 任何修改必须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.
重安装
如果你更新一些软件(所用的我们的库或第三方库),或者你简单想重装下它:
- 清空OpenPose及Caffe编译文件夹:
make clean && cd 3rdparty/caffe && make clean
- 重复Installation 步骤. 你不需要再下载这些模块了.
卸载
你仅需要删除OpenPose文件夹, 如rm -rf openpose/.
-----------------------------
Windows
安装- Demo
安装- Library
- 安装的前提要求:
- Microsoft VS2015 Enterprise Update 3. VS2017 Community不支持, VS 2015 Community没被测试过.
- 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!
- cuDNN 5.1: 一旦你已经下载它, 就解压拷贝(merge)其内容到CUDA文件夹, C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0.
- 下载OpenPose 依赖和模块 (body, face and hand models),即双击{openpose_path}\windows\download_3rdparty_and_models.bat. 相当于,你可以手动下载它们:
- 模块:
- COCO model: download in models/pose/coco/.
- MPI model: download in models/pose/mpi/.
- Face model: download in models/face/.
- Hands model: download in models/hand/.
- 依赖:
- Caffe: Unzip as 3rdparty/windows/caffe/.
- Caffe dependencies: Unzip as 3rdparty/windows/caffe3rdparty/.
- OpenCV 3.1: Unzip as 3rdparty/windows/opencv/.
- 打开VS project sln 文件,即双击{openpose_path}\windows\OpenPose.sln.
- 为了确认OpenPose在运行, 尝试编译执行demo:
- 右键OpenPoseDemo --> Set as StartUp Project.
- 改为 Debug by Release mode.
- 用F5编译运行.
- 如果你有了已经连接的webcam, OpenPose 在编译后将自动开始.
- 为了从命令行上使用创建的exe文件, 你必须:
- 拷贝{openpose_folder}\3rdparty\windows\caffe\bin\ 的所有DLLs到{openpose_folder}\windows\x64\Release.
- 拷贝{openpose_folder}\3rdparty\windows\opencv\x64\vc14\bin\的所有DLLs到: {openpose_folder}\windows\x64\Release.
- 打开cmd (Windows button + X, then A).
- 进到OpenPose目录: cd C:\openpose\.
- 运行教程命令.
- 在默认的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