OpenFace 2.0 - Mac OS installation and pose detection

Pranav Srivastava
2 min readMar 4, 2021

--

Using the below steps I was able to setup OpenFace on MacOs.

Step 1 — Install Homebrew using the below command. Skip this step if you already have it installed.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Step 2 — Install the below homebrew formulae

 brew update
brew install gcc --HEAD
brew install boost
brew install tbb
brew install openblas
brew install --build-from-source dlib
brew install wget
brew install opencv
brew install cmake

Step 3 — Clone the repo

git clone https://github.com/TadasBaltrusaitis/OpenFace

Step 4 — The landmark detection model is large in size and is therefore not included in the repo. Can be downloaded using the below command.

cd OpenFacebash download_models.sh

Step 5 — Now is the time to build the model. For a successful build, you will see binaries in the bin folder. If not, you can see the suggestions mentioned later in this post

mkdir buildcd buildcmake -D CMAKE_BUILD_TYPE=RELEASE ..  make

Step 6 — Execution! You can detect poses using the below command and see the demo.

cd OpenFacecd build./bin/FaceLandmarkVid -f your_video_file.mp4

You can check the demo here: https://youtu.be/5BpYxJsK8w8

Step 7 — In case you want to store the results (like — hog, landmark points etc) then use this command.

./bin/FaceLandmarkVidMulti -f your_video_file.mp4 -out_dir processedOR ./bin/FaceLandmarkImg -f your_video_file.mp4 -out_dir processed
  • Installation problems and probable solutions:
1) If you are building using gcc 8 then make sure you have gcc@8 installed. Run the following.brew install gcc@82) If you see error related to C or CXX compiler identification unknown then make sure you have the path set. If not run the following.You can get the exact path by executing `which gcc` or `which g++` or `which gcc-8`. If your machine has a different location then change the below reference with the correct value.export CC=/usr/local/bin/gcc-8
export CXX=/usr/local/bin/gcc++
3) If you see errors when executing the `make` command, consider deleting the contents of /build folder. Rerun `cmake` and then `make`.

References:

[1] https://github.com/TadasBaltrusaitis/OpenFace/wiki/Mac-installation

[2]https://colab.research.google.com/gist/jcheong0428/c16146b386ea60fab888b56e8e5ee747/openface_shared.ipynb

[3]https://stackoverflow.com/questions/54633860/how-can-i-fix-the-cmake-c-compiler-is-not-a-full-path-and-was-not-found-in-the

--

--