论文复现--OpenPose: Realtime Multi-Person 2D Pose Estimation using Part Affinity Fields

分类:动作捕捉
github地址:https://github.com/CMU-Perceptual-Computing-Lab/openpose
所需环境:Windows10,cmake3.27.1,Visual Stdio 2017(其他也可)


本环境配置主要参考这个帖子 1,有改动

下载依赖和模型

进入OpenPose的github项目中,点击3rdparty
在这里插入图片描述
点击pybind11,进入该项目并将该项目下载下来。pybind11用于OpenPose编译后可以通过python调用。
在这里插入图片描述
在这里插入图片描述
将pybind11压缩包解压,将其中的内容复制到之前解压好的OpenPose目录中的3rdparty/pybind11中。
在这里插入图片描述

在这里插入图片描述
进入本地3rdparty/windows目录中,双击执行其中的几个以bat为后缀名的批处理文件。它们会下载OpenPose项目所需要的caffe,opencv等框架。
在这里插入图片描述
然而实际上,bat脚本并不能下载。因为官网设置了访问权限,好像是因为访问的人太多了导致的2,3。。。
在这里插入图片描述
但是作者又给了结局方案,他直接上传到谷歌盘了3

G Drive version:
Models: https://drive.google.com/file/d/1QCSxJZpnWvM00hx49CJ2zky7PWGzpcEh
3rdparty before 2021: https://drive.google.com/file/d/1mqPEnqCk5bLMZ3XnfvxA4Dao7pj0TErr
3rdparty for 2021 versions: https://drive.google.com/file/d/1WvftDLLEwAxeO2A-n12g5IFtfLbMY9mG(现在是2023年,需要下载这个)
没法科学上网,可以使用我的链接:
链接:https://pan.baidu.com/s/1LzUWZCkV7pQpNq_DxPm3rw?pwd=1234
提取码:1234

在这里插入图片描述
所以直接下载模型和2021版的第三方库:会得到3rdparty_v1_2021.zipmodels.zip

3rdparty_v1_2021.zip解压到3rdparty/windows目录下,并解压依赖包。其中caffe由caffe_16_2020_11_14解压而来,opencv由opencv_450_v15_2020_11_18解压而来4
在这里插入图片描述

models.zip解压到models目录,并将解压后的face hand pose文件夹与原本的face hand pose文件夹合并。
在这里插入图片描述
合并后的文件夹如下:
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

使用CMake生成openpose工程文件

打开Cmake-gui,第一行选中OpenPose的目录,第二行指定生成项目的路径,可以自行设置。
项目路径:D:/WLm_Project/MotionCatch/OpenPose/openpose-master
工程路径:D:/WLm_Project/MotionCatch/OpenPose/openpose-master/build
在这里插入图片描述
点击configure,由于我们需要编译64位的,这里选择win64。vs版本要与已安装的一致。点击finish就会自动进行配置。
在这里插入图片描述
待cmake配置完成(本机器已经之前安装过CUDA,所以不会报错,提示信息都是CMake警告。具体安装参考这个帖子),CMake输出以下信息:

CMake Warning (dev) at CMakeLists.txt:19 (project):
  cmake_minimum_required() should be called prior to this top-level project()
  call.  Please see the cmake-commands(7) manual for usage documentation of
  both commands.
This warning is for project developers.  Use -Wno-dev to suppress it.

Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.19045.
The C compiler identification is MSVC 19.16.27045.0
The CXX compiler identification is MSVC 19.16.27045.0
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe - skipped
Detecting C compile features
Detecting C compile features - done
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe - skipped
Detecting CXX compile features
Detecting CXX compile features - done
CMake Deprecation Warning at CMakeLists.txt:34 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


CMAKE_VERSION = 3.27.1
CMake Warning (dev) at CMakeLists.txt:214 (find_package):
  Policy CMP0146 is not set: The FindCUDA module is removed.  Run "cmake
  --help-policy CMP0146" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

This warning is for project developers.  Use -Wno-dev to suppress it.

Found CUDA: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.6 (found version "11.6") 
Building with CUDA.
CMake Warning (dev) at CMakeLists.txt:353 (find_package):

找到BUILD_PYTHON,并打上勾,这样编译后才会生成可供python调用的包。
在这里插入图片描述
因为我们要编译GPU版本,所以GPU_MODE不变,依然是CUDA。
在这里插入图片描述
cudnn之前也配置过,所以USE_CUDNN标志位保持不变。

在这里插入图片描述
上面的操作执行完成后,点击generate进行生成。出现Generating Done后,点击Open Project便可自动打开vs2017.

完整版信息如下:

CMake Warning (dev) at CMakeLists.txt:19 (project):
  cmake_minimum_required() should be called prior to this top-level project()
  call.  Please see the cmake-commands(7) manual for usage documentation of
  both commands.
This warning is for project developers.  Use -Wno-dev to suppress it.

Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.19045.
CMake Deprecation Warning at CMakeLists.txt:34 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


CMAKE_VERSION = 3.27.1
CMake Warning (dev) at CMakeLists.txt:214 (find_package):
  Policy CMP0146 is not set: The FindCUDA module is removed.  Run "cmake
  --help-policy CMP0146" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

This warning is for project developers.  Use -Wno-dev to suppress it.

Building with CUDA.
CMake Warning (dev) at CMakeLists.txt:353 (find_package):
  Policy CMP0146 is not set: The FindCUDA module is removed.  Run "cmake
  --help-policy CMP0146" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

This warning is for project developers.  Use -Wno-dev to suppress it.

Downloading windows dependencies...
opencv_450_v15_2020_11_18.zip already exists.
caffe3rdparty_16_2020_11_14.zip already exists.
caffe_16_2020_11_14.zip already exists.
Windows dependencies downloaded.
Adding Example Calibration
Adding Example tutorial_add_module_custom_post_processing
Adding Example tutorial_api_thread_1_user_processing_function
Adding Example tutorial_api_thread_2_user_input_processing_output_and_datum
Adding Example OpenPoseDemo
Adding Example 01_body_from_image_default
Adding Example 02_whole_body_from_image_default
Adding Example 03_keypoints_from_image
Adding Example 04_keypoints_from_images
Adding Example 05_keypoints_from_images_multi_gpu
Adding Example 06_face_from_image
Adding Example 07_hand_from_image
Adding Example 08_heatmaps_from_image
Adding Example 09_keypoints_from_heatmaps
Adding Example 10_asynchronous_custom_input
Adding Example 11_asynchronous_custom_input_multi_camera
Adding Example 12_asynchronous_custom_output
Adding Example 13_asynchronous_custom_input_output_and_datum
Adding Example 14_synchronous_custom_input
Adding Example 15_synchronous_custom_preprocessing
Adding Example 16_synchronous_custom_postprocessing
Adding Example 17_synchronous_custom_output
Adding Example 18_synchronous_custom_all_and_datum
Download the models.
Downloading BODY_25 model...
Model already exists.
Not downloading body (COCO) model
Not downloading body (MPI) model
Downloading face model...
Model already exists.
Downloading hand model...
Model already exists.
Models Downloaded.
'git' 不是内部或外部命令,也不是可运行的程序
或批处理文件。

CMake Deprecation Warning at 3rdparty/pybind11/CMakeLists.txt:8 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


CMake Deprecation Warning at 3rdparty/pybind11/tools/pybind11Tools.cmake:8 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.
Call Stack (most recent call first):
  3rdparty/pybind11/CMakeLists.txt:33 (include)


CMake Warning (dev) at 3rdparty/pybind11/tools/FindPythonLibsNew.cmake:60 (find_package):
  Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
  are removed.  Run "cmake --help-policy CMP0148" for policy details.  Use
  the cmake_policy command to set the policy and suppress this warning.

Call Stack (most recent call first):
  3rdparty/pybind11/tools/pybind11Tools.cmake:16 (find_package)
  3rdparty/pybind11/CMakeLists.txt:33 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

pybind11 v2.3.dev0
Configuring done (2.8s)
Generating done (0.9s)

使用VS2017编译源码

手动打开build中的OpenPose.sln工程文件,配置管理器选择Release x64。选中OpenPoseDemo项目,右键-重新生成,即可编译OpenPose源代码,生成可执行文件。右侧还有数十个Demo可以编译。也可以通过上方的生成-生成解决方案进行整个项目的编译。
在这里插入图片描述
编译生成的可执行文件会放在x64/Release文件夹下。
在这里插入图片描述
在这里插入图片描述

运行OpenPoseDemo

直接点击运行或者ctrl+F5即可打开摄像头。
在这里插入图片描述
此外,官方还提供了很多API,可以自行编译。运行下很有趣,依赖的媒体在examples文件夹
如08_heatmaps_from_image,就是制作heatmap用的。
在这里插入图片描述

参考链接

1.Windows10编译CPU版OpenPose
2.MSVC OpenPose failed to download windows dependencies #2227
3.Unable to fetch/download models #1602
4.windows编译openpose及在python中调用

猜你喜欢

转载自blog.csdn.net/weixin_44848751/article/details/132062162