Difference between revisions of "Openface: Instalasi di Ubuntu 16.04 Server"

From OnnoWiki
Jump to navigation Jump to search
(Created page with "==Instalasi Aplikasi Pendukung== sudo apt -y install virtualenv git \ libopenblas-dev libopencv-dev libboost-dev libboost-python-dev python-dev \ build-essential gcc g++ c...")
 
Line 1: Line 1:
==Instalasi Aplikasi Pendukung==
+
Sumber: https://github.com/TadasBaltrusaitis/OpenFace/wiki/Unix-Installation
  
sudo apt -y install virtualenv git \
 
libopenblas-dev libopencv-dev libboost-dev libboost-python-dev python-dev \
 
build-essential gcc g++ cmake
 
  
Buat virtual environment untuk Python 2 di folder fd_fr
 
  
  
Create a compartmentalized Python environment with Python 2 (has to be this version required by Openface) and copy necessary OpenCV's Python bindings onto it. Let's call the fd_fr directory VENV_ROOT.
 
  
mkdir fd_fr; cd fd_fr
+
Unix Installation
export VENV_ROOT=$(pwd)
+
Tadas Baltrusaitis edited this page 10 days ago · 20 revisions
virtualenv -p /usr/bin/python2.7 .
+
Pages 13
cp /usr/lib/python2.7/dist-packages/cv* lib/python2.7/site-packages/
 
source bin/activate
 
  
Tip when running on RPI : As RPI devices have very little memory and the storage device being an SDcard, performance can drop dramatically when run with tons of file I/O. One way to remedy is by flushing the page cache after large file I/O operations with the following command periodically during the installation process going forward.
+
    Home
 +
    Action Units
 +
    API calls
 +
    Code Layout
 +
    Command line arguments
 +
    Datasets
 +
    Mac installation
 +
    Model download
 +
    Model Training
 +
    Output Format
 +
    Point Distribution Model
 +
    Unix Installation
 +
    Windows Installation
  
sync
+
Clone this wiki locally
sudo bash -c "echo 3 > /proc/sys/vm/drop_caches"
+
Install script
  
1. Install and run Dlib face landmark detection
+
On most systems you can install OpenFace using the download_models.sh followed by ./install.sh script, if that does not work, use the following steps.
Get Dlib either by cloning it from their github repository or downloading a released version. At the time of this writing, that is version v19.3 so I'm going to clone the repository and checkout that tag.
 
  
git clone https://github.com/davisking/dlib.git dlib
+
For more details on model downloads see - https://github.com/TadasBaltrusaitis/OpenFace/wiki/Model-acquisition
cd dlib
+
Advanced Ubuntu installation
git checkout -b v19.3
 
  
If on RPI, do not compile Dlib on the device as some files require 800+MB of memory which cause massive swap to device and CPU utilization falls below 5%. I recommend doing this on the host PC and run ARM emulation using qemu-arm-static and then copying. But if you're feeling lazy, I have done all this (and subsequent steps) that you can access via this link. More details on this in Section 5.
+
For Unix based systems and different compilers, I included Cmake files for cross-platform and cross-IDE support.
  
Tip with qemu-arm-static internet connection : Especially if behind a proxy, be sure to share contents of /etc/resolv.conf with chroot environment either by copying or bind mount
+
This code has been tested on Ubuntu 14.04.1 with GCC, and on 15.10 with Clang 3.7.1.
  
mount --bind /etc/resolv.conf /rpi/mount/etc/resolv.conf for behind proxy
+
You can also run the install.sh script for installing on Ubuntu 16.04 (it combines the following steps into one script)
 +
Dependency installation
  
The build process is done with cmake. If you have a relatively new CPU, it should have the AVX (Advanced Vector Extensions) which greatly enhances the performance. You can find either or not your CPU supports this functionality by executing "cat /proc/cpuinfo | grep avx". If you get a non-empty text, then your CPU supports it. If it does, include the "-DUSE_AVX..." statement below.
+
This requires cmake, OpenCV 3.1.0 (or newer), tbb and boost.
  
mkdir build; cd build
+
To acquire all of the dependencies follow the instructions pertaining to your Operating System:
cmake ../tools/python -DUSE_AVX_INSTRUCTIONS=1
+
Ubuntu gcc compiler instructions
cmake --build . --config Release
 
  
Copy generated dlib.so file to Python's lib/ path and test it by importing it from Python.
+
    Get newest GCC, done using:
  
cp dlib.so ${VENV_ROOT}/lib/python2.7/dist-packages/
+
    sudo apt-get update
python -c "import dlib"
 
  
If this second statement returns an error, you have done something wrong.
+
    sudo apt-get install build-essential
  
(optional) To run Dlib with a face and landmark detector on a webcam feed, first download the model for the latter from here and unzip it. I have written a short script on my gist page which requires the webcam class. You need to download the latter to run the former as well as the model.
+
    Cmake:
2. Install and build Torch
 
Torch is an opensource machine learning library based on Lua. Detailed instructions to get started available on their site. They recommend using a script to install some packages but I've been burned one too many times by erroneous scripts with sudo rights and so I will write out what it's doing in plain English.
 
  
On another folder (not Dlib), clone the repository.
+
    sudo apt-get install cmake
  
git clone https://github.com/torch/distro.git torch --recursive
+
    Get BLAS (for dlib)
cd torch
 
  
To install necessary packages (if on an Ubuntu 16.04 system like moi), run
+
    sudo apt-get install libopenblas-dev liblapack-dev
  
# for Ubuntu 16.04
+
    OpenCV 3.4.0
sudo apt-get install software-properties-common \
 
                libgraphicsmagick1-dev libfftw3-dev sox libsox-dev \
 
                libsox-fmt-all
 
sudo apt-get install python-software-properties
 
sudo apt-get install build-essential gcc g++ curl \
 
            cmake libreadline-dev git-core libqt4-dev libjpeg-dev \
 
            libpng-dev ncurses-dev imagemagick libzmq3-dev gfortran \
 
            unzip gnuplot gnuplot-x11 ipython
 
sudo apt-get install -y gcc-4.9 libgfortran-4.9-dev g++-4.9
 
  
For Raspbian
+
    4.1 Install OpenCV dependencies:
  
# for Raspbian Jessie
+
    sudo apt-get install git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get install -y build-essential gcc g++ curl \
 
            cmake libreadline-dev git-core libqt4-dev libjpeg-dev \
 
            libpng-dev ncurses-dev imagemagick libzmq3-dev gfortran \
 
            unzip gnuplot gnuplot-x11 ipython
 
  
Now run the install.sh script (which is more like a build script) and source the environment activation file.
+
    sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev checkinstall
  
./install.sh
+
    4.2 Download OpenCV 3.4.0 from https://github.com/opencv/opencv/archive/3.4.0.zip
source install/bin/torch-activate
 
  
Caveat 1.  
+
    wget https://github.com/opencv/opencv/archive/3.4.0.zip
The necessary paths in "install/bin/torch-activate" are hard-coded absolute paths so if you move the installed directory, be sure to change these as well.
 
  
Caveat 2.  
+
    4.3 Unzip it and create a build folder:
Older versions of CUDA will not work. If you don't feel like updating, just install without it by adding "path_to_nvcc=" to line 82 in install.sh file.
 
  
Caveat 2-1.  
+
    sudo unzip 3.4.0.zip
For old or Atom based systems that do not have AVX, the library is automatically going to use SSE which has a bug on randperm function. Rest assured, it was fixed recently so be sure to pull that patch if running on Atom.
+
    cd opencv-3.4.0
 +
    mkdir build
 +
    cd build
  
3. Install Openface
+
    4.4 Build it using:
Now for the final piece of the puzzle, clone the repository.
 
  
git clone https://github.com/cmusatyalab/openface.git openface
+
    cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_SHARED_LIBS=OFF ..
cd openface
 
  
There has been a release on Feb 26, 2016 and it's been roughly a year since. So I think it's better to just use the tip rather than checking out  the last release. Next, install and download necessary artifacts.
+
    make -j2
  
python setup.py install
+
    sudo make install
./models/get-models.sh
 
pip install -r requirements.txt
 
luarocks install csvigo
 
luarocks install dpnn
 
  
4. Get labeled faces and train on them
+
    Get Boost:
It's now finally time to run Openface and see what it can do. To get a good batch of labeled faces on which to run the recognition task on, there is the LFW (labeled faces in the wild) dataset. Download then unzip which creates a directory lfw containing 5k directory of IDs.
 
  
wget http://vis-www.cs.umass.edu/lfw/lfw.tgz
+
    sudo apt-get install libboost1.55-all-dev
tar -zxvf lfw.tgz
 
  
I'm going to select from this a list that only has an excess of 10 faces and save it into a file called big_db.
+
    alternatively: sudo apt-get install libboost-all-dev
  
find lfw/ -mindepth 1 -maxdepth 2 -type d -exec bash -c "echo -ne '{} '; ls '{}' | wc -l" \; | awk '$NF>10{print $1}' > big_db
+
Ubuntu clang compiler instructions
  
Next, I'm going to select 10 random people out of this list and copy them to another folder called training-images.
+
    Get LLVM, Clang and libc++:
  
mkdir -p training-images
+
    1.1 Install LLVM and Clang dependencies:
cat big_db | shuf -n 10 | xargs cp -avt training-images/
 
  
If you'd like to recognize yourself, add a folder in training-images. Be sure to include many photos in which you're the single identifiable human face.
+
    sudo apt-get update
  
We're now doing to run face landmark detection on each photo which will
+
    sudo apt-get install build-essential
  
* Detect the biggest face
+
    1.2 Install LLVM:
* Detect the facial landmarks (outer eyes, nose and lower lip)
 
* Warp affine to a canonical face
 
* Save output (96x96) to a file in an easy to access format
 
  
 +
    sudo apt-get install llvm
  
To do this, run
+
    1.3 Install Clang along with relevant packages:
  
./util/align-dlib.py ./training-images/ align outerEyesAndNose ./aligned-images/ --size 96
+
        Check that the correct repository is enabled by inspecting '/etc/apt/sources.list':
  
Next, run feature extraction on each of the images.
+
        sudo gedit /etc/apt/sources.list
  
./batch-represent/main.lua -outDir ./generated-embeddings/ -data ./aligned-images/
+
        If 'universe' is not included, modify the file so that it is:
  
As a final step, train a classifier from generated representations.
+
        deb http://us.archive.ubuntu.com/ubuntu wily main universe
  
./demos/classifier.py train ./generated-embeddings/
+
        After any such changes, update the system with:
  
This will create a file called classifier.pkl in generated-embeddings folder.
+
        sudo apt-get update
  
 +
        Get Clang and libc++:
  
 +
        sudo apt-get install clang libc++-dev libc++abi-dev
  
5. Run
+
    Get Cmake:
To test if everything is working properly before working with the trained model from Section 4, let's try this on a pre-trained model. There is a pre-trained model on celebrities in folder. To test using this image, run
 
  
./demos/classifier.py infer models/openface/celeb-classifier.nn4.small2.v1.pkl images/examples/adams.jpg
+
    sudo apt-get install cmake
  
Artifacts of sections 1~4 done on RPI are on this link. Be sure to extract it from /home/pi/ to produce /home/pi/fd_fr as the internal scripts are hardcoded to that location. I've made a couple of changes to the base as this is run on a 32bit environment. Running "git diff" from /home/pi/fd_fr/openface will reveal the changes.
+
    Get BLAS (for dlib)
  
This should correctly predict the sample image as Amy Adams which predicts with 81% certainty but on RPI is 34% which I find odd...
+
    sudo apt-get install libopenblas-dev liblapack-dev
  
To complete the final leg of our journey, I recommend testing on yourself. I saved a photo of myself that I didn't include in the training set as sky_chon.jpg. To test the trained model on me, I run
+
    OpenCV 3.4.0
  
./demos/classifier.py infer generated-embeddings/classifier.pkl sky_chon.jpg
+
    4.1 Install OpenCV dependencies:
  
To run using the webcam (dev/video0) on VGA.
+
    sudo apt-get install git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
  
./demos/classifier_webcam.py --width 640 --height 480 --captureDevice 0 generated-embeddings/classifier.pkl
+
    sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev checkinstall
  
Works like a charm!!
+
    4.2 Download OpenCV 3.4.0 from https://github.com/opencv/opencv/archive/3.4.0.zip
  
References
+
    wget https://github.com/opencv/opencv/archive/3.4.0.zip
  
     https://medium.com/@ageitgey/machine-learning-is-fun-part-4-modern-face-recognition-with-deep-learning-c3cffc121d78#.lugw83dgc
+
     4.3 Unzip it and create a build folder:
    https://cmusatyalab.github.io/openface/
 
    http://dlib.net/
 
    http://blog.dlib.net/2014/02/dlib-186-released-make-your-own-object.html
 
    http://bamos.github.io/2016/01/19/openface-0.2.0/
 
    https://github.com/davisking/dlib
 
    http://dlib.net/files/shape_predictor_68_face_landmarks.dat.bz2
 
    https://github.com/torch/torch7/issues/966
 
    https://wiki.debian.org/RaspberryPi/qemu-user-static
 
    https://hblok.net/blog/posts/2014/02/06/chroot-to-arm/
 
    https://lukeplant.me.uk/blog/posts/sharing-internet-connection-to-chroot/
 
    https://hblok.net/blog/posts/2014/02/06/chroot-to-arm/
 
    https://github.com/cmusatyalab/openface/issues/42
 
  
 +
    sudo unzip 3.4.0.zip
 +
    cd opencv-3.4.0
 +
    mkdir build
 +
    cd build
 +
 +
    4.4 Build it using:
 +
 +
    cmake -D CMAKE_CXX_COMPILER=clang++ -D CMAKE_CXX_FLAGS="-std=c++11 -stdlib=libc++ -I/usr/include/libcxxabi" -D CMAKE_EXE_LINKER_FLAGS="-std=c++11 -stdlib=libc++ -lc++abi" -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D OPENCV_EXTRA_MODULES_PATH=<path to opencv_contrib modules> -D BUILD_TIFF=ON -D WITH_V4L=ON -D WITH_GTK=ON -D BUILD_opencv_dnn=OFF -D WITH_TBB=ON ..
 +
 +
    make -j2
 +
 +
    sudo make install
 +
 +
    Get Boost 1.61.0:
 +
 +
    5.1 Install boost dependency:
 +
 +
    sudo apt-get install libbz2-dev
 +
 +
    5.2 Get the boost source:
 +
 +
    Download boost_1_61_0.tar.bz2.
 +
 +
    In the directory where you want to put the boost installation, execute:
 +
 +
    tar --bzip2 -xf /path/to/boost_1_61_0.tar.bz2
 +
 +
    5.3 Build and install:
 +
 +
    cd path/to/boost_1_61_0
 +
    ./bootstrap.sh --with-toolset=clang --prefix=/usr/local
 +
    ./b2 toolset=clang cxxflags="-std=c++11 -stdlib=libc++ -I/usr/include/libcxxabi" linkflags="-stdlib=libc++" --prefix=/usr/local -j 10 define=BOOST_SYSTEM_NO_DEPRECATED stage release
 +
    sudo ./b2 install toolset=clang cxxflags="-std=c++11 -stdlib=libc++" linkflags="-stdlib=libc++" --prefix=/usr/local
 +
 +
Actual OpenFace installation
 +
 +
    Get OpenFace
 +
 +
    git clone https://github.com/TadasBaltrusaitis/OpenFace.git
 +
 +
    Create an out-of-source build directory to store the compiled artifacts:
 +
 +
    cd OpenFace
 +
    mkdir build
 +
    cd build
 +
 +
    Compile the code using instructions pertaining to your operating system:
 +
 +
        Ubuntu 14.04
 +
 +
        cmake -D CMAKE_BUILD_TYPE=RELEASE ..
 +
 +
        make
 +
 +
        Ubuntu 15.10
 +
 +
        cmake -D CMAKE_CXX_COMPILER=clang++ -D CMAKE_CXX_FLAGS="-std=c++11 -stdlib=libc++ -I/usr/include/libcxxabi" -D CMAKE_EXE_LINKER_FLAGS="-std=c++11 -stdlib=libc++ -lc++abi" -D CMAKE_BUILD_TYPE=RELEASE ..
 +
 +
        make
 +
 +
    Test it with
 +
 +
        for videos:
 +
 +
        ./bin/FaceLandmarkVid -f "../samples/changeLighting.wmv" -f "../samples/2015-10-15-15-14.avi"
 +
 +
        for images:
 +
 +
        ./bin/FaceLandmarkImg -fdir "../samples/" -wild
 +
 +
        for multiple faces in videos:
 +
 +
        ./bin/FaceLandmarkVidMulti -f ../samples/multi_face.avi
 +
 +
        for feature extraction (facial landmarks, head pose, AUs, gaze and HOG and similarity aligned faces):
 +
 +
        ./bin/FeatureExtraction -verbose -f "../samples/default.wmv"
 +
 +
Troubleshooting
 +
X server
 +
 +
If you experience a problem with "cannot connect to X server" when trying to execute the tracker, a solution can be found here http://askubuntu.com/questions/64820/wkhtmltopdf-wkhtmltoimage-cannot-connect-to-x-server, to resolve run: apt-get install xvfb
 +
Anaconda
 +
 +
When Anaconda is installed, somehow OpenCV finds the outdated GCC 4.x instead of GCC 5.4, according to: https://stackoverflow.com/questions/40322301/compile-opencv-3-on-ubuntu-16-04-linking-error-usr-lib-x86-64-linux-gnu-libsox
 +
 +
This results in OpenFace giving the error: usr/lib/x86_64-linux-gnu/libsoxr.so.0: undefined reference to `GOMP_parallel@GOMP_4.0' collect2: error: ld returned 1 exit status
  
  
Line 188: Line 238:
 
==Referensi==
 
==Referensi==
  
* http://allskyee.blogspot.co.id/2017/03/face-detection-and-recognition-using.html
+
* https://github.com/TadasBaltrusaitis/OpenFace/wiki/Unix-Installation

Revision as of 07:23, 22 May 2018

Sumber: https://github.com/TadasBaltrusaitis/OpenFace/wiki/Unix-Installation



Unix Installation Tadas Baltrusaitis edited this page 10 days ago · 20 revisions Pages 13

   Home
   Action Units
   API calls
   Code Layout
   Command line arguments
   Datasets
   Mac installation
   Model download
   Model Training
   Output Format
   Point Distribution Model
   Unix Installation
   Windows Installation

Clone this wiki locally Install script

On most systems you can install OpenFace using the download_models.sh followed by ./install.sh script, if that does not work, use the following steps.

For more details on model downloads see - https://github.com/TadasBaltrusaitis/OpenFace/wiki/Model-acquisition Advanced Ubuntu installation

For Unix based systems and different compilers, I included Cmake files for cross-platform and cross-IDE support.

This code has been tested on Ubuntu 14.04.1 with GCC, and on 15.10 with Clang 3.7.1.

You can also run the install.sh script for installing on Ubuntu 16.04 (it combines the following steps into one script) Dependency installation

This requires cmake, OpenCV 3.1.0 (or newer), tbb and boost.

To acquire all of the dependencies follow the instructions pertaining to your Operating System: Ubuntu gcc compiler instructions

   Get newest GCC, done using:
   sudo apt-get update
   sudo apt-get install build-essential
   Cmake:
   sudo apt-get install cmake
   Get BLAS (for dlib)
   sudo apt-get install libopenblas-dev liblapack-dev
   OpenCV 3.4.0
   4.1 Install OpenCV dependencies:
    sudo apt-get install git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
    sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev checkinstall
   4.2 Download OpenCV 3.4.0 from https://github.com/opencv/opencv/archive/3.4.0.zip
    wget https://github.com/opencv/opencv/archive/3.4.0.zip
   4.3 Unzip it and create a build folder:
    sudo unzip 3.4.0.zip
    cd opencv-3.4.0
    mkdir build
    cd build
   4.4 Build it using:
    cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_SHARED_LIBS=OFF ..
   make -j2
   sudo make install
   Get Boost:
   sudo apt-get install libboost1.55-all-dev
   alternatively: sudo apt-get install libboost-all-dev

Ubuntu clang compiler instructions

   Get LLVM, Clang and libc++:
   1.1 Install LLVM and Clang dependencies:
   sudo apt-get update
   sudo apt-get install build-essential
   1.2 Install LLVM:
   sudo apt-get install llvm
   1.3 Install Clang along with relevant packages:
       Check that the correct repository is enabled by inspecting '/etc/apt/sources.list':
       sudo gedit /etc/apt/sources.list
       If 'universe' is not included, modify the file so that it is:
       deb http://us.archive.ubuntu.com/ubuntu wily main universe
       After any such changes, update the system with:
       sudo apt-get update
       Get Clang and libc++:
       sudo apt-get install clang libc++-dev libc++abi-dev
   Get Cmake:
   sudo apt-get install cmake
   Get BLAS (for dlib)
   sudo apt-get install libopenblas-dev liblapack-dev
   OpenCV 3.4.0
   4.1 Install OpenCV dependencies:
    sudo apt-get install git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
    sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev checkinstall
   4.2 Download OpenCV 3.4.0 from https://github.com/opencv/opencv/archive/3.4.0.zip
    wget https://github.com/opencv/opencv/archive/3.4.0.zip
   4.3 Unzip it and create a build folder:
    sudo unzip 3.4.0.zip
    cd opencv-3.4.0
    mkdir build
    cd build
   4.4 Build it using:
    cmake -D CMAKE_CXX_COMPILER=clang++ -D CMAKE_CXX_FLAGS="-std=c++11 -stdlib=libc++ -I/usr/include/libcxxabi" -D CMAKE_EXE_LINKER_FLAGS="-std=c++11 -stdlib=libc++ -lc++abi" -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D OPENCV_EXTRA_MODULES_PATH=<path to opencv_contrib modules> -D BUILD_TIFF=ON -D WITH_V4L=ON -D WITH_GTK=ON -D BUILD_opencv_dnn=OFF -D WITH_TBB=ON ..
   make -j2
   sudo make install
   Get Boost 1.61.0:
   5.1 Install boost dependency:
   sudo apt-get install libbz2-dev
   5.2 Get the boost source:
   Download boost_1_61_0.tar.bz2.
   In the directory where you want to put the boost installation, execute:
   tar --bzip2 -xf /path/to/boost_1_61_0.tar.bz2
   5.3 Build and install:
    cd path/to/boost_1_61_0
    ./bootstrap.sh --with-toolset=clang --prefix=/usr/local
    ./b2 toolset=clang cxxflags="-std=c++11 -stdlib=libc++ -I/usr/include/libcxxabi" linkflags="-stdlib=libc++" --prefix=/usr/local -j 10 define=BOOST_SYSTEM_NO_DEPRECATED stage release
    sudo ./b2 install toolset=clang cxxflags="-std=c++11 -stdlib=libc++" linkflags="-stdlib=libc++" --prefix=/usr/local

Actual OpenFace installation

   Get OpenFace
   git clone https://github.com/TadasBaltrusaitis/OpenFace.git
   Create an out-of-source build directory to store the compiled artifacts:
    cd OpenFace
    mkdir build
    cd build
   Compile the code using instructions pertaining to your operating system:
       Ubuntu 14.04
       cmake -D CMAKE_BUILD_TYPE=RELEASE ..
       make
       Ubuntu 15.10
       cmake -D CMAKE_CXX_COMPILER=clang++ -D CMAKE_CXX_FLAGS="-std=c++11 -stdlib=libc++ -I/usr/include/libcxxabi" -D CMAKE_EXE_LINKER_FLAGS="-std=c++11 -stdlib=libc++ -lc++abi" -D CMAKE_BUILD_TYPE=RELEASE ..
       make
   Test it with
       for videos:
       ./bin/FaceLandmarkVid -f "../samples/changeLighting.wmv" -f "../samples/2015-10-15-15-14.avi"
       for images:
       ./bin/FaceLandmarkImg -fdir "../samples/" -wild
       for multiple faces in videos:
       ./bin/FaceLandmarkVidMulti -f ../samples/multi_face.avi
       for feature extraction (facial landmarks, head pose, AUs, gaze and HOG and similarity aligned faces):
       ./bin/FeatureExtraction -verbose -f "../samples/default.wmv"

Troubleshooting X server

If you experience a problem with "cannot connect to X server" when trying to execute the tracker, a solution can be found here http://askubuntu.com/questions/64820/wkhtmltopdf-wkhtmltoimage-cannot-connect-to-x-server, to resolve run: apt-get install xvfb Anaconda

When Anaconda is installed, somehow OpenCV finds the outdated GCC 4.x instead of GCC 5.4, according to: https://stackoverflow.com/questions/40322301/compile-opencv-3-on-ubuntu-16-04-linking-error-usr-lib-x86-64-linux-gnu-libsox

This results in OpenFace giving the error: usr/lib/x86_64-linux-gnu/libsoxr.so.0: undefined reference to `GOMP_parallel@GOMP_4.0' collect2: error: ld returned 1 exit status



Referensi