Estimating partial human poses
Tags: machinelearning, openpose, tensorflow, deeplearning
Published: 2019-05-31 11:23:08

---
title: Estimating partial human poses
published: true
date: '2019-05-31T11:23:08.570Z'
tags: machine-learning, openpose, tensorflow, deep-learning
canonical_url: https://medium.com/@dvirsegal/estimating-partial-human-poses-d1548a4a9080
---

![Testing the [_Crazy Uptown Funk flashmob in Sydney_](https://www.youtube.com/watch?v=2DiQUX11YaY) video sequence with OpenPose](https://cdn-images-1.medium.com/max/800/0*vLPWgysrOYR7aP5C.gif)

<span>
<em>Originally published at <a href="https://medium.com/@dvirsegal/estimating-partial-human-poses-d1548a4a9080" style="color:#1395b8">Medium</a> on <time datetime="2019-05-31T11:23:08.570Z" title="Friday, May 31, 2019, 11:23:08 AM">May 31, 2019 </time>
</em>
</span>

A lot has been said on [OpenPose](https://github.com/CMU-Perceptual-Computing-Lab/openpose). This real-time multi-person groundbreaking keypoints detection method has many features, along with:

*   2D real-time multi-person keypoint detection
*   3D real-time single-person keypoint detection
*   Calibration toolbox
*   Single-person tracking
*   Supporting Python API, Unity Plugin, Cuda, OpenCL, and CPU only

Moreover, more features are in the works by the team ([Gines Hidalgo](https://www.gineshidalgo.com/), [Zhe Cao](https://people.eecs.berkeley.edu/~zhecao), [Tomas Simon](http://www.cs.cmu.edu/~tsimon), [Shih-En Wei](https://scholar.google.com/citations?user=sFQD3k4AAAAJ&hl=en), [Hanbyul Joo](https://jhugestar.github.io/), [Yaser Sheikh](http://www.cs.cmu.edu/~yaser), and [Yaadhav Raaj](https://www.raaj.tech/)) at [Carnegie Mellon University](https://www.cmu.edu/). The below link is being updated occasionally for new frameworks’ changes. Besides, it contains an installation guide, troubleshooting, and a quick start section. So, go ahead, have a look, and play with it.

[**CMU-Perceptual-Computing-Lab/openpose**](https://github.com/CMU-Perceptual-Computing-Lab/openpose "https://github.com/CMU-Perceptual-Computing-Lab/openpose)

#### What 🙋?

One of the caveats of OpenPose framework is to identify a partial human image as determined by my Master’s supervisor, Professor [Hagit Hel-Or](https://cs.haifa.ac.il/~hagit/). The system’s model was trained on human figures taken from several [datasets](http://domedb.perception.cs.cmu.edu/) ([COCO](http://cocodataset.org/) and [MPII](http://human-pose.mpi-inf.mpg.de/)), while the images contain different people on various backgrounds, most of them don’t include only “part” of a person image (for example, only shoulders).

It means the algorithm fails to identify the connected graph of all identified body parts. While a body **part** is an element of the human body (like hand, neck, hip) and a **pair** is two connected parts.

The image below, taken from the excellent Medium blog-posts [series](https://arvrjourney.com/human-pose-estimation-using-openpose-with-tensorflow-part-1-7dd4ca5c8027) by [Ale Solano](https://medium.com/u/e34ee48c0a61) displays the skeletons as represented by the COCO dataset (pairs and parts):

![Parts and Pairs indexes for COCO dataset](https://cdn-images-1.medium.com/max/800/1*BJQRrQGuW8VLH8MfA9ZngQ.png)
Parts and Pairs indexes for COCO dataset

I recommend reading [Ale Solano](https://medium.com/u/e34ee48c0a61)’s series for more details on OpenPose pipeline which I don’t plan to drill down into as part of this blog-post.

My goal in this opensource project is to allow using the vast capabilities of OpenPose system on images containing only partial body parts. The following GIF emphasizes the framework’s limitation:

![OpenPose Limitation](https://cdn-images-1.medium.com/max/800/0*Lmi9odoXsT1PE3EI.gif)

#### Why 🤷?

I intended to learn various concepts to enrich my technical stack, like using machine learning, get a better understanding of computer vision concepts, and using OpenPose. I did all the above while having fun and eventually contributing to the opensource community.

As a side effect, by sorting out OpenPose limitation, it may help other researchers who hesitate using it.

Say, for example, you would like to identify a person’s key points, or as said in the computer vision jargon, skeleton. However, the image appears cut or intentionally contains only part of the human body. One application may be for physical therapy to identify treatment improvements. More usages exist depending on the user’s purpose.

#### How 🤓?

The proposed method (credit to my Master’s supervisor) is to add the missing body part into the image **_wisely_**. Afterward, run the OpenPose framework on the reconstructed image. The result is then manipulated to show the skeleton on the original body image.

**The following images show the algorithm flow on an original image of human legs:**

1.  A partial (legs) image is given
2.  An upper (dummy) image is matched to the original body part, and a merged image is created
3.  An OpenPose skeleton is generated for the combined image
4.  The skeleton result is reduced to the original image only

As can be seen below:

![_Algorithm flow from left to right_](https://cdn-images-1.medium.com/max/800/0*IVJ6dqAjTl9oy3b9.JPG)

The reconstructed image is created by first identifying the object in the original image, using a [tensorflow trained model](https://github.com/tensorflow/models/blob/master/research/object_detection/object_detection_tutorial.ipynb) (DetecorAPI with [faster\_rcnn](https://arxiv.org/abs/1506.01497)) based on COCO dataset. The model returns a bounding box of the detected object. Then by using the box’s dimensions, the dummy image is being manipulated to the original image characteristics by an affine transformation.

Eventually, the two images are being stitched together, and OpenPose is being triggered on the new image.

The below video demonstrate the result of a walking person video:

![Original Video](https://cdn-images-1.medium.com/max/800/0*N9-JdRI9VmTtWIGa.gif)
![Skeletonized Video](https://cdn-images-1.medium.com/max/800/0*dOPab9YXD4QjqHsg.gif)


To sum up, OpenPose has great potential for endless applications, enabling motion detection without dedicated hardware like Kinect, a 2D camera is enough. Overcoming on one of the framework limitations can step us forward for that goal, and this is the real power of the opensource community.

I hope you’ll find it interesting (👏).

The project’s code can be found here:

[**DeJaVoo/partial-openpose**](https://github.com/DeJaVoo/partial-openpose)