Yoga pose estimation using Openpose on Mac OSX with CPU

Pallawi
4 min readApr 27, 2023

Yoga is a highly individualized practice and can be tailored to suit your specific needs and goals. Whether you are looking to improve your physical fitness, reduce stress and anxiety, or simply connect more deeply with your inner self, yoga offers a wide range of practices and techniques that can help you achieve your goals.

Overall, being a yoga person means embracing a holistic approach to health and well-being, and using the tools and practices of yoga to cultivate greater physical, mental and emotional balance in your life.

I am a Yoga person. I am grateful and thankful to all the Yoga gurus who help their students practice yoga for good health. You can build a Yoga pose estimation AI tool to help yoga practitioners all over the world practice yoga aasanas perfectly and gain the best out of the aasanas.

Here is my effort to help you begin here with Openpose.

OpenPose can be run on a Mac, but there are some prerequisites you need to have installed before you can use it.

Here are the steps to run OpenPose on a Mac:

  1. Install Homebrew: Homebrew is a package manager for macOS. Open Terminal and paste the following command and press Enter:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

2. Install dependencies: OpenPose requires several dependencies to be installed on your system. Run the following commands in the Terminal to install them:

brew install cmake
brew install pkg-config
brew install ffmpeg
brew install opencv@2
brew link --force opencv@2
brew install openblas
brew install glog
brew install veclibfort
brew install boost

3. Clone OpenPose repository: Open Terminal and navigate to the directory where you want to clone OpenPose. Then, paste the following command and press Enter:

git clone https://github.com/CMU-Perceptual-Computing-Lab/openpose.git

4. Build OpenPose: Navigate to the OpenPose directory and create a build directory. Then, run the following commands:

cd openpose
mkdir build
cd build
cmake ..
make -j`sysctl -n hw.logicalcpu`

5. Download the prototxt file: If the prototxt file is missing, you can download it from the OpenPose GitHub repository. You can do this by running the following command in the terminal:

wget https://raw.githubusercontent.com/CMU-Perceptual-Computing-Lab/openpose/master/models/pose/body_25/pose_deploy.prototxt -P /Users/prajendr/workhere/openpose/include/openpose/models/pose/body_25/

6. Check the permissions of the file: If the prototxt file is present, but you are still getting the error, it may be due to incorrect file permissions. Check the permissions of the file by running the following command:

ls -l /Users/prajendr/workhere/openpose/models/pose/body_25/pose_deploy.prototxt

7. Run OpenPose: After building OpenPose, you can run it by running the following command in the build directory:

Run the below command from the main folder example path, ‘/Users/prajendr/workhere/openpose/’

./build/examples/openpose/openpose.bin --video ./examples/media/video.avi

That’s it! You should now be able to run OpenPose on your Mac.

Run the below command to be able to use more command line flags using openpose.bin

./build/examples/openpose/openpose.bin --help 
./build/examples/openpose/openpose.bin -image_dir ./examples/media/Yoga/ -write_images ./examples/media/Yoga_output/

If you run into any error you may want to check the official issue page of openpose, which is — https://github.com/CMU-Perceptual-Computing-Lab/openpose/issues

List of issues that I faced and successfully resolved while building the openpose on my Mac OS X:

  1. Execution error ( protobuf candidate expects 1 argument, 2 provided)
  2. MacOs Get ‘cblas.h’ file not found When make
  3. Could NOT find vecLib (missing: vecLib_INCLUDE_DIR)

4. Could not find openblas — Check the oath in CMakeLists.txt

Conclusion:

I am a creative Data Scientist and I love playing with images. Openpose was on my list for a very long time. I am a Yoga practitioner too. Yoga has done miracles in my life. Here is my AI + Yoga take.

I have blurred the faces in my demo images to respect the identity of people. These images were used only for research purposes.

Based on my experience here are a few applications you can build and help society with implementing Openpose:

  1. Yoga pose estimation
  2. Pet pose and activity analysis
  3. Monitoring elderly people's activities
  4. Monitoring students in the classroom
  5. Crowd management in an auditorium

Let me know what you want to build. I am definitely taking my Yoga pose estimation to the next level.

References:

--

--

Pallawi

Computer Vision contributor. Lead Data Scientist @https://www.here.com/ Love Data Science.