Simple Web App for Human Pose Detection Using Docker and OpenPose

Daniel Barker
2 min readNov 8, 2022

We live in a golden age of ML. Sites like Hugging Faces and OpenAI publish incredible open source libraries that allow us to harness countless hours of research to perform object detection, segmentation, classification and so much more in just a few lines of code.

This is all great, until you want to start building a more sophisticated application that chains together lots of different models. Inevitably, one will require Tensorflow v1.5 with CUDA version 8.1, the next PyTorch v1.13 with CUDA 11.7 and yet another with some archaic Caffe dependency, and so on.

I ran into this situation recently working on an idea that required human pose detection as an initial step in the processing pipeline. The team at the CMU Perceptual Computing lab have put together some incredible models for this task and published it as the OpenPose library. While there documentation is very good, building the code from source is still somewhat of a pain. And when trying to rapid prototype a solution for something that you don’t know will even work in the end, you really just want something that you can try out quickly.

To make things easier, I put together a simple dockerized web app / REST API using that uses Streamlit.io for the front end and OpenPose for the backend inference engine. To use it, it’s as simple as:

git clone git@github.com:dcbark01/openpose_app.git# cd into the root project directory
docker compose up

Once the images are pulled and the containers running, you should be able to visit http://localhost:8501/ and presented with the demo UI page; use the file upload box to upload an example image and click run inference:

If you want to send post requests with input images to the API directly, see the “demo.ipynb” Jupyter Notebook provided in the repo for a simple example.

And that’s it! Hopefully this has made pose detection as painless as possible for you. Good luck on your application!

--

--

Daniel Barker

Co-Founder @ Phin | Engineer with a cybernetic bent. Unabashed pseudo-intellectual; can usually be found struggling to capture deeper thoughts in prose ’n code.