> ## Content Index
> Fetch the complete content index at: https://cms.yufeiran.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# OpenPose 调研
- URL: https://cms.yufeiran.com/openpose-diao-yan/
- Published: 2022-11-11T01:06:00.000Z
- Updated: 2026-09-27T12:42:24.000Z
- Author: Feiran Yu
- Tags: #legacy-import

# 背景

我们实验室做人体重建方向比较多，这个[OpenPose](https://github.com/CMU-Perceptual-Computing-Lab/openpose?ref=cms.yufeiran.com)是人体姿态估计方面非常厉害的项目，通过学习它，有助于入门人体重建。同时，它也是一个在GitHub现在拥有25k star 代码行数约12w行的开源项目，从软件开发的角度，它的设计架构也很值得学习。所以我将进行调研。  
下图是OpenPose的一个运行效果。  

![dance_foot](https://yufeiran.com/content/images/2022/11/dance_foot.gif)

  
可以看到每个人都被绘制上了合理的躯干和关节位置，而且这个算法可以实时运行！效果还是不错的。

# 0.ppt

结合网络资料和我自己的理解，我整理的OpenPose原理ppt：

📁 **File:** OpenPose [Download](https://yufeiran.com/content/files/2023/12/OpenPose.pptx?ref=cms.yufeiran.com)

OpenPose软件设计的ppt：

📁 **File:** OpenPose [Download](https://yufeiran.com/content/files/2023/12/OpenPose------.pptx?ref=cms.yufeiran.com)

# 调研计划

调研主要就是看懂论文，跑明白代码,将由以下部分组成：

1. 论文阅读分析
2. 下载和编译源代码
3. 跑通它提供的一些demo
4. 阅读和分析OpenPose的代码架构

# 1.论文阅读分析

整个OpenPose工作的历程是由几篇工作组成的：  
首先是Realtime Multi-Person 2D Pose Estimation using Part Affinity Fields，在这篇论文中他们提出了PAFs算法。  
接着是OpenPose: Realtime Multi-Person 2D Pose Estimation using Part Affinity Fields，在这篇工作中，他们对整个系统进行了改进，加快了运行速度和准确性，并整合了身体、脚、手和脸部关键点，最终完成了OpenPose这个开源库。

## Abstract

主要说明了OpenPose用了他们提出的PAFs(Part Affinity Fields)算法，比起传统自底向上的系统，有更好的性能表现，具体表现为自底向上的系统随着场景中人数增加，开销也线性增加，而OpenPose却始终保持相同的开销。同时OpenPose是第一个整合了身体、脚、手和脸部关键点的开源实时框架。

## 1.1 Introduction

## 1.2 Method

## 1.2.1

[Part Affinity Fields论文理解](https://zhuanlan.zhihu.com/p/79594205?ref=cms.yufeiran.com)  
[如何评价卡内基梅隆大学的开源项目 OpenPose？ - 残生十七世的回答 - 知乎](https://www.zhihu.com/question/59750782/answer/530824012?ref=cms.yufeiran.com)  
VGG网络：[一文读懂VGG网络](https://zhuanlan.zhihu.com/p/41423739?ref=cms.yufeiran.com)

深度学习里的concat和add的区别如下  

![v2-04817784bef75d724d38cc22fcad8e35_720w](https://yufeiran.com/content/images/2022/11/v2-04817784bef75d724d38cc22fcad8e35_720w.webp)

[非极大值抑制(Non-Maximum Suppression)](https://zhuanlan.zhihu.com/p/37489043?ref=cms.yufeiran.com)

# 2.下载和编译源代码

虽然它也提供了编译好的二进制包，但是为了研究其结构，我这里还是使用源代码编译的方式。  
它文档中指导编译的部分：[Compiling and Running OpenPose from Source](https://github.com/CMU-Perceptual-Computing-Lab/openpose/blob/master/doc/installation/0%5Findex.md?ref=cms.yufeiran.com#compiling-and-running-openpose-from-source)  
编译该项目需要CUDA，直接去官网下载：[CUDA Toolkit 11.8 Downloads](https://developer.nvidia.com/cuda-downloads?target%5Fos=Windows&target%5Farch=x86%5F64&target%5Fversion=11&target%5Ftype=exe%5Flocal&ref=cms.yufeiran.com)

# 2.1 Windows下编译源代码

在windows平台中源码编译比较简单，只需要安装git或者GitHub客户端、CMAKE-GUI、CUDA。  
在我的win11 x64中很顺利的编译完成了。

# 3.运行DEMO

它工程中提供了许多的demo，我这里测试了大部分都可以直接运行，体验非常好！  

![QQ–20221107210632](https://yufeiran.com/content/images/2022/11/QQ--20221107210632.png)

## 找到ta的数据集，自己跑一次

# 4.阅读和分析OpenPose的代码架构

[openpose源码阅读总结](https://zhuanlan.zhihu.com/p/140720737?ref=cms.yufeiran.com)  
根据它在GitHub仓库中留下的信息，这个OpenPose主要是使用C++并使用GPU并行计算，实现了他们实验室的两篇工作：  
OpenPose\_Realtime\_Multi-Person\_2D\_Pose 和  
Hand Keypoint Detection in Single Images using Multiview Bootstrapping

它的文档在[/doc/index.html](https://cmu-perceptual-computing-lab.github.io/openpose/web/html/doc/index.html?ref=cms.yufeiran.com)  
整个代码结构介绍在 [md\_doc\_very\_advanced\_library\_structure\_1\_library\_deep\_overview.html](https://cmu-perceptual-computing-lab.github.io/openpose/web/html/doc/md%5Fdoc%5Fvery%5Fadvanced%5Flibrary%5Fstructure%5F1%5Flibrary%5Fdeep%5Foverview.html?ref=cms.yufeiran.com)

## 这篇文档介绍了OpenPose的核心数据结构Array和Datum。

大部分结构都由Temple写成，可以比较通用的用在不同地方。Array是整个OpenPose存储数据的结构，Datum是后面线程返回和输入的数据结构，线程之间通过这个数据结构进行通信。

## 接着介绍了OpenPose的线程管理：thread。

介绍了thread的创建、运行、管理。由于也是用Temple编写而成，可以方便的将自己的函数挂进这个进程管理。

## 最后介绍这个系统的核心：多人关键点检测模块。

介绍了Caffe实现的Pose提取器，和如何初始化它。接着介绍如何检测人群的pose，介绍输入值和返回值。然后介绍了将结果渲染回图片的过程，使用PoseRenderer模块（文档与当前实际程序有出入，api参数对不上）。

它的整体代码UML图在[UML.pdf](https://github.com/CMU-Perceptual-Computing-Lab/openpose/blob/1f1aa9c59fe59c90cca685b724f4f97f76137224/doc/very%5Fadvanced/library%5Fstructure/UML/1%5F0%5F0rc3/UML.pdf?ref=cms.yufeiran.com)