openpose的快速使用教程

Contents

  1. Quick Start
    1. BODY_25 vs. COCO vs. MPI Models
    2. Running on Video
    3. Running on Webcam
    4. Running on Images
    5. Maximum Accuracy Configuration
    6. 3-D Reconstruction
    7. Tracking
  2. Expected Visual Results

Quick Start

Check that the library is working properly by running any of the following commands on any command-line interface program. In Ubuntu, Mac, and other Unix systems, use any command-line interface, such as Terminal or Terminator. 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/). In addition, examples/media/video.avi and examples/media do exist, no need to change the paths.

BODY_25 vs. COCO vs. MPI Models

The BODY_25 model (--model_pose BODY_25) includes both body and foot keypoints and it is based in OpenPose: Realtime Multi-Person 2D Pose Estimation using Part Affinity Fields. COCO and MPI models are slower, less accurate, and do not contain foot keypoints. They are based in our older paper Realtime Multi-Person 2D Pose Estimation using Part Affinity Fields. We highly recommend only using the BODY_25 model.

There is an exception, for CPU version, the COCO and MPI models seems to be faster. Accuracy is still better for the BODY_25 model.

Running on Video

# Ubuntu and Mac
./build/examples/openpose/openpose.bin --video examples/media/video.avi
# With face and hands
./build/examples/openpose/openpose.bin --video examples/media/video.avi --face --hand
:: 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

Running on Webcam

# Ubuntu and Mac
./build/examples/openpose/openpose.bin
# With face and hands
./build/examples/openpose/openpose.bin --face --hand
:: Windows - Portable Demo
bin\OpenPoseDemo.exe
:: With face and hands
bin\OpenPoseDemo.exe --face --hand
:: Windows - Library - Assuming you copied the DLLs following doc/installation.md#windows
build\x64\Release\OpenPoseDemo.exe
:: With face and hands
build\x64\Release\OpenPoseDemo.exe --face --hand

Running on Images

# Ubuntu and Mac
./build/examples/openpose/openpose.bin --image_dir examples/media/
# With face and hands
./build/examples/openpose/openpose.bin --image_dir examples/media/ --face --hand
:: Windows - Portable Demo
bin\OpenPoseDemo.exe --image_dir examples\media\
:: With face and hands
bin\OpenPoseDemo.exe --image_dir examples\media\ --face --hand
:: Windows - Library - Assuming you copied the DLLs following doc/installation.md#windows
build\x64\Release\OpenPoseDemo.exe --image_dir examples\media\
:: With face and hands
build\x64\Release\OpenPoseDemo.exe --image_dir examples\media\ --face --hand

Maximum Accuracy Configuration

This command provides the most accurate results we have been able to achieve for body, hand and face keypoint detection.

However:

  • This will not work on CPU given the huge ammount of memory required. Your only option with CPU-only versions is to manually crop the people to fit the whole area of the image that is fed into OpenPose.
  • It will also need ~10.5 GB of GPU memory for body-foot (BODY_25) model (~6.7 GB for COCO model).
  • This requires GPUs like Titan X, Titan XP, some Quadro models, P100, V100, etc.
  • Including hands and face will require >= 16GB GPUs (so the 12 GB GPUs like Titan X and XPs will no longer work).
  • This command runs at ~2 FPS on a Titan X for the body-foot model (~1 FPS for COCO).
  • Increasing --net_resolution will highly reduce the frame rate and increase latency, while it might increase the accuracy. However, this accuracy increase is not guaranteed in all scenarios, required a more detailed analysis for each particular scenario. E.g., it will work better for images with very small people, but usually worse for people taking a big ratio of the image. Thus, we recommend to follow the commands below for maximum accuracy in most cases for both big and small-size people.
  • Do not use this configuration for MPII model, its accuracy might be harmed by this multi-scale setting. This configuration is optimal only for COCO and COCO-extended (e.g., the default BODY_25) models.

Method overview:

# Ubuntu and Mac: Body
./build/examples/openpose/openpose.bin --net_resolution "1312x736" --scale_number 4 --scale_gap 0.25
# Ubuntu and Mac: Body + Hand + Face
./build/examples/openpose/openpose.bin --net_resolution "1312x736" --scale_number 4 --scale_gap 0.25 --hand --hand_scale_number 6 --hand_scale_range 0.4 --face
:: Windows - Portable Demo: Body
bin\OpenPoseDemo.exe --net_resolution "1312x736" --scale_number 4 --scale_gap 0.25
:: Windows - Portable Demo: Body + Hand + Face
bin\OpenPoseDemo.exe --net_resolution "1312x736" --scale_number 4 --scale_gap 0.25 --hand --hand_scale_number 6 --hand_scale_range 0.4 --face
:: Windows - Library - Assuming you copied the DLLs following doc/installation.md#windows: Body
build\x64\Release\OpenPoseDemo.exe --net_resolution "1312x736" --scale_number 4 --scale_gap 0.25
:: Windows - Library - Assuming you copied the DLLs following doc/installation.md#windows: Body + Hand + Face
build\x64\Release\OpenPoseDemo.exe --net_resolution "1312x736" --scale_number 4 --scale_gap 0.25 --hand --hand_scale_number 6 --hand_scale_range 0.4 --face

If you want to increase the accuracy value metric on COCO, while harming the qualitative accuracy, add the flag --maximize_positives. It reduces the thresholds to accept a person candidate. It highly increases both false and true positives. I.e., it maximizes average recall but could harm average precision. Our experience is that it looks much worse visually, but it improves the COCO accuracy numbers, so use it at your own risk.

In addition, our paper numbers are not based on the current models that have been released. We released our best model at the time but later found a better one. But given that the accuracy difference is less than 2%, we did not want to release yet another model to avoid confusion for the users (otherwise there would be more than 10 models released at this point). We will release a new one every time a major improvement is achieved.

If you are operating on Ubuntu, you can check the experimental scripts that we use to test our accuracy (we do not officially support it, i.e., we will not answer questions about it, as well as it might change it continuously), they are placed in openpose/scripts/tests/, called pose_accuracy_coco_test_dev.sh and pose_accuracy_coco_val.sh.

3-D Reconstruction

  1. Real-time demo
# Ubuntu and Mac
./build/examples/openpose/openpose.bin --flir_camera --3d --number_people_max 1
# With face and hands
./build/examples/openpose/openpose.bin --flir_camera --3d --number_people_max 1 --face --hand
:: Windows - Portable Demo
bin\OpenPoseDemo.exe --flir_camera --3d --number_people_max 1
:: With face and hands
bin\OpenPoseDemo.exe --flir_camera --3d --number_people_max 1 --face --hand
:: Windows - Library - Assuming you copied the DLLs following doc/installation.md#windows
build\x64\Release\OpenPoseDemo.exe --flir_camera --3d --number_people_max 1
:: With face and hands
build\x64\Release\OpenPoseDemo.exe --flir_camera --3d --number_people_max 1 --face --hand
  1. Saving 3-D keypoints and video
# Ubuntu and Mac (same flags for Windows version)
./build/examples/openpose/openpose.bin --flir_camera --3d --number_people_max 1 --write_json output_folder_path/ --write_video_3d output_folder_path/video_3d.avi
  1. Fast stereo camera image saving (without keypoint detection) for later post-processing
# Ubuntu and Mac (same flags for Windows version)
# Saving video
# Note: saving in PNG rather than JPG will improve image quality, but slow down FPS (depending on hard disk writing speed and camera number)
./build/examples/openpose/openpose.bin --flir_camera --num_gpu 0 --write_video output_folder_path/video.avi --write_video_fps 5
# Saving images
# Note: saving in PNG rather than JPG will improve image quality, but slow down FPS (depending on hard disk writing speed and camera number)
./build/examples/openpose/openpose.bin --flir_camera --num_gpu 0 --write_images output_folder_path/ --write_images_format jpg
  1. Reading and processing previouly saved stereo camera images
# Ubuntu and Mac (same flags for Windows version)
# Optionally add `--face` and/or `--hand` to include face and/or hands
# Assuming 3 cameras
# Note: We highly recommend to reduce `--output_resolution`. E.g., for 3 cameras recording at 1920x1080, the resulting image is (3x1920)x1080, so we recommend e.g. 640x360 (x3 reduction).
# Video
./build/examples/openpose/openpose.bin --video output_folder_path/video.avi --3d_views 3 --3d --number_people_max 1 --output_resolution {desired_output_resolution}
# Images
./build/examples/openpose/openpose.bin --image_dir output_folder_path/ --3d_views 3 --3d --number_people_max 1 --output_resolution {desired_output_resolution}
  1. Reconstruction when the keypoint is visible in at least x camera views out of the total n cameras
# Ubuntu and Mac (same flags for Windows version)
# Reconstruction when a keypoint is visible in at least 2 camera views (assuming `n` >= 2)
./build/examples/openpose/openpose.bin --flir_camera --3d --number_people_max 1 --3d_min_views 2 --output_resolution {desired_output_resolution}
# Reconstruction when a keypoint is visible in at least max(2, min(4, n-1)) camera views
./build/examples/openpose/openpose.bin --flir_camera --3d --number_people_max 1 --output_resolution {desired_output_resolution}

Tracking

  1. Runtime huge speed up by reducing the accuracy:
# Using OpenPose 1 frame, tracking the following e.g., 5 frames
./build/examples/openpose/openpose.bin --tracking 5 --number_people_max 1
  1. Runtime speed up while keeping most of the accuracy:
:: Using OpenPose 1 frame and tracking another frame
./build/examples/openpose/openpose.bin --tracking 1 --number_people_max 1
  1. Visual smoothness:
# Running both OpenPose and tracking on each frame. Note: There is no speed up/slow down
./build/examples/openpose/openpose.bin --tracking 0 --number_people_max 1

Expected Visual Results

The visual GUI should show the original image with the poses blended on it, similarly to the pose of this gif:

If you choose to visualize a body part or a PAF (Part Affinity Field) heat map with the command option --part_to_show, the result should be similar to one of the following images:

### 回答1: OpenPose是一种用于实时多人姿势估计的库,它可以用于计算机视觉和人机交互等领域。下面是使用OpenPose的简单教程: 1. 安装所需的软件和库:在使用OpenPose之前,您需要安装CMake(用于构建OpenPose)和OpenCV(用于图像处理)。您可以根据您的操作系统和喜好选择适当的版本。 2. 下载OpenPose:您可以从OpenPose的官方GitHub仓库中下载源代码并解压缩到本地文件夹。 3. 构建OpenPose:使用CMake构建OpenPose库。打开命令行终端并导航到您解压缩的OpenPose文件夹。然后创建一个新的文件夹(例如"build"),并在此文件夹中运行CMake命令。CMake将根据您的系统配置构建OpenPose。 4. 打开命令终端:使用命令行终端导航到OpenPose文件夹中的build目录。 5. 运行OpenPose:在命令行中,输入以下命令以运行OpenPose: ./openpose.bin --image_path <your_image_path> 替换<your_image_path>为您要检测人体姿势的图像路径。OpenPose将分析图像并在图像中标记出人体的关节位置。 6. 更多选项:OpenPose还提供其他参数和选项,以便更好地适应您的需求。您可以在运行OpenPose时使用--help命令查看所有可用的选项和其含义。 以上是使用OpenPose的基本教程。如果您想要进一步了解如何配置和使用OpenPose,可以参考OpenPose的官方文档和示例代码。 ### 回答2: OpenPose是一个开源的人体姿态估计库,它可以通过分析图像或视频来检测和估计人体的关节点和姿态。 使用OpenPose进行人体姿态估计有几个关键的步骤。首先,我们需要准备一些输入数据,可以是图像或视频。然后,我们需要配置OpenPose的参数,例如选择人体姿态的模型(正常模型或小型模型)以及设置输出结果的详细程度等。 接下来,我们可以调用OpenPose的API来进行人体姿态估计。对于每一帧图像或视频,OpenPose会检测人体的关节点(例如鼻子、眼睛、手臂等)并估计它们之间的关系,以获得一个完整的人体姿态。这些关节点的坐标信息可以用来进一步分析和应用,例如人体行为分析、动作识别等。 在使用OpenPose时,我们还可以通过设置一些参数来优化姿态估计的结果。例如,我们可以调整最小置信度阈值以过滤掉一些不可靠的关节点检测结果,或者设置人体检测的尺度参数以应对不同尺寸的输入数据。 最后,在使用OpenPose之后,我们可以根据需要进行后处理,例如绘制图像中的人体关节点和骨骼连线,或者根据关节点的位置进行进一步的计算和分析。 总的来说,OpenPose是一个强大的人体姿态估计库,可以应用于各种领域,例如人机交互、运动分析等。使用OpenPose进行人体姿态估计的主要步骤包括准备数据、配置参数、调用API进行姿态估计、优化结果以及后处理等。 ### 回答3: OpenPose是一种用于姿势估计和多人关键点检测的开源框架。下面是OpenPose的简单使用教程。 1. 安装环境:首先,我们需要安装OpenPose以及其所需的依赖项。可以直接从OpenPose的官方GitHub页面下载源代码和相关文件,并按照说明进行安装。 2. 配置参数:在运行OpenPose之前,需要配置一些参数。这些参数包括输入图像路径、模型选择、输出文件路径等。可以通过修改配置文件进行参数配置。 3. 运行OpenPose:使用命令行工具,导航到OpenPose的安装目录,并使用命令行启动OpenPose。根据你的操作系统,可能需要提供一个图像或视频作为输入。 4. 检测结果:一旦运行OpenPose,它将开始对输入图像进行姿势估计和多人关键点检测。检测完成后,结果将保存在指定的输出文件中。 5. 后续处理:根据需要,可以使用其他工具或库对OpenPose的输出结果进行后续处理。例如,可以使用OpenCV来显示和处理姿势估计结果。 OpenPose是一个功能强大且灵活的框架,可以用于各种应用,包括人体动作识别、手势识别、虚拟现实等。但是对于OpenPose的深入使用和高级功能,可能需要更多的学习和理解,例如自定义模型、数据集训练等。 总结而言,OpenPose是一个强大的开源框架,它通过姿势估计和多人关键点检测为我们提供了丰富的人体动作信息。使用OpenPose可以为人工智能和计算机视觉应用提供强大的功能和支持。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

FL1623863129

你的打赏是我写文章最大的动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值