官方安装说明
官方安装需求:
一、CMake
由于之前已经安装过tensorflow-gpu,cuda10.0,VS2019等已经安装。只需要下载安装cmake。
Install CMake GUI: Download and install the Latest Release
of CMake Windows win64-x64 Installer
from the CMake download website, called cmake-X.X.X-win64-x64.msi
.
cmake 下载地址:https://cmake.org/download/
二、下载OpenPose
https://github.com/CMU-Perceptual-Computing-Lab/openpose
三、OpenPose Configuration
Open CMake GUI and select the OpenPose directory as project source directory, and a non-existing or empty sub-directory (e.g., build
) where the Makefile files (Ubuntu) or Visual Studio solution (Windows) will be generated. If build
does not exist, it will ask you whether to create it. Press Yes
.
Press the Configure
button, keep the generator in Unix Makefile
(Ubuntu) or set it to your 64-bit Visual Studio version (Windows), and press Finish
. Note for Windows users: CMake-GUI has changed their design after version 14. For versions older than 14, you usually select Visual Studio XX 20XX Win64
as the generator (X
depends on your VS version), while the Optional toolset to use
must be empty. However, new CMake versions require you to select only the VS version as the generator, e.g., Visual Studio 15 2017
, and then you must manually choose x64
for the Optional platform for generator
. See the following images as example.
If this step is successful, the Configuring done
text will appear in the bottom box in the last line. Otherwise, some red text will appear in that same bottom box.
Press the Generate
button and proceed to OpenPose Building. You can now close CMake.
Note: If you prefer to use your own custom Caffe or OpenCV versions, see Custom Caffe or Custom OpenCV respectively.
- 说明:
1. caffe我电脑上本来没有,但是在CMake configure的时候会自动下载。但是由于网络原因,出现了类似以下错误:
CMake Error at cmake/Utils.cmake:23 (file):
file DOWNLOAD HASH mismatch
for file: [C:/Users/Win10/Desktop/openpose-master/3rdparty/windows/opencv_401_v14_15_2019_03_14.zip]
expected hash: [df8f611c032cfa86c56a8ad419f01832]
actual hash: [d41d8cd98f00b204e9800998ecf8427e]
status: [7;"Couldn't connect to server"]
Call Stack (most recent call first):
CMakeLists.txt:557 (download_zip)
这时需要手动下载,放到Openpose包的3rdparty/windows/
CMake automatically downloads all the Windows DLLs. Alternatively, you might prefer to download them manually:
- Dependencies:
- Note: Leave the zip files in
3rdparty/windows/
so that CMake does not try to download them again. - Caffe: Unzip as
3rdparty/windows/caffe/
. - Caffe dependencies: Unzip as
3rdparty/windows/caffe3rdparty/
. - OpenCV 4.0.1: Unzip as
3rdparty/windows/opencv/
.
- Note: Leave the zip files in
下载之后解压到对应文件夹,注意文件夹名称:caffe、caffe3rdparty、opencv,否则会出现如下错误:
CMake Error: The following variables are used in this project but they are set to NOTFOUND.
压缩文件就放在3rdparty/windows/下就好,不然还会自动下载。
2. 模型也没有下载成功,需要手动下载。
Very important: New Nvidia model GPUs (e.g., Nvidia V, GTX 2080, v100, any Nvidia with Volta or Turing architecture, etc.) require (at least) CUDA 10. CUDA 8 would fail!
In addition, CMake automatically downloads all the OpenPose models. However, some firewall or company networks block these downloads. You might prefer to download them manually:
- [BODY_25 model](http://posefs1.perception.cs.cmu.edu/OpenPose/models/pose/body_25/pose_iter_584000.caffemodel): download in `models/pose/body_25/`.
- [COCO model](http://posefs1.perception.cs.cmu.edu/OpenPose/models/pose/coco/pose_iter_440000.caffemodel): download in `models/pose/coco/`.
- [MPI model](http://posefs1.perception.cs.cmu.edu/OpenPose/models/pose/mpi/pose_iter_160000.caffemodel): download in `models/pose/mpi/`.
- [Face model](http://posefs1.perception.cs.cmu.edu/OpenPose/models/face/pose_iter_116000.caffemodel): download in `models/face/`.
- [Hands model](http://posefs1.perception.cs.cmu.edu/OpenPose/models/hand/pose_iter_102000.caffemodel): download in `models/hand/`.
Finally, if some weird/obscure errors about Caffe and/or Pybind appear, run the following command. It will ensure that all submodules are iniatilised. Reason: OpenPose runs that command through CMake, but some firewalls might block it and we have to run it manually.
git submodule update --init --recursive --remote
四、OpenPose Building
In order to build the project, select and run only one of the 2 following alternatives.
-
CMake-GUI alternative (recommended): Open the Visual Studio solution (Windows), called
build/OpenPose.sln
. Then, set the configuration fromDebug
toRelease
and press the green triangle icon (alternatively press F5).
五、Run OpenPose
在cmd或Powershell(win+X,A)运行命令。详细请参考:
https://github.com/CMU-Perceptual-Computing-Lab/openpose/blob/master/doc/quick_start.md#quick-start
Forget about the OpenPose library code, just compile the library and use the demo ./build/examples/openpose/openpose.bin
.
In order to learn how to use it, run ./build/examples/openpose/openpose.bin --help
in your favorite command-line interface tool and read all the available flags (check only the flags for examples/openpose/openpose.cpp
itself, i.e., the section Flags from examples/openpose/openpose.cpp:
).
In Windows, open the PowerShell
(recommended) or Windows Command Prompt (CMD). They can be open by pressing the Windows button + X, and then A. Feel free to watch any Youtube video tutorial if you are not familiar with these non-GUI tools. Make sure that you are in the root directory of the project (i.e., in the OpenPose folder, not inside build/
nor windows/
nor bin/
).
例:
Running on Video
:: Windows - Portable Demo
bin\OpenPoseDemo.exe --video examples\media\video.avi
:: With face and hands
bin\OpenPoseDemo.exe --video examples\media\video.avi --face --hand
:: Windows - Library - Assuming you copied the DLLs following doc/installation.md#windows
build\x64\Release\OpenPoseDemo.exe --video examples\media\video.avi
:: With face and hands
build\x64\Release\OpenPoseDemo.exe --video examples\media\video.avi --face --hand
我的电脑由于配置的原因不能用命令运行,只能在程序上直接改参数。openpose使用的google gflags。可以在flag.hpp中修改参数。详细参数介绍也可参考:
https://github.com/CMU-Perceptual-Computing-Lab/openpose/blob/master/doc/demo_overview.md#main-flags