Installing OpenFace: an open source facial behavior analysis toolkit

Installation System: Ubuntu 16.04

1. Installing dependencies:

sudo apt-get update
sudo apt-get install build-essential
sudo apt-get install llvm
sudo gedit /etc/apt/sources.list
change
deb http://us.archive.ubuntu.com/ubuntu/ xenial main restricted
to
deb http://us.archive.ubuntu.com/ubuntu/ xenial main universe
sudo apt-get update
sudo apt-get install clang-3.7 libc++-dev libc++abi-dev
sudo apt-get install cmake
sudo apt-get install libopenblas-dev liblapack-dev
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
wget https://github.com/Itseez/opencv/archive/3.1.0.zip
sudo unzip 3.1.0.zip
cd opencv-3.1.0
mkdir build
cd build/
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_SHARED_LIBS=OFF ..
make -j4
sudo make install
sudo apt-get install libboost-all-dev

2. Installing OpenFace

git clone https://github.com/TadasBaltrusaitis/OpenFace.git
cd OpenFace/
mkdir build

cd build/
cmake -D CMAKE_BUILD_TYPE=RELEASE ..
make

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

3. Using from MATLAB  (Error Resolution: ibstdc++.so.6: version `CXXABI_1.3.8′ not found)

To solve this issue, I found setting the LD_LIBARARY_PATH from the script works for me. Just add the following at the beginning of the script (change the libstdc++.so.6 path according to your system):

setenv('LD_LIBRARY_PATH', '/usr/lib/x86_64-linux-gnu/libstdc++.so.6');

Sample script for running FaceLandmarkImg

from subprocess import call


# FaceLandmarkImg
#
# Single image analysis
#
# -f <filename> the image file being input, can have multiple -f flags
# -of <filename> location of output file for landmark points, gaze and action units
# -op <filename> location of output file for 3D landmark points and head pose
# -gaze indicate that gaze estimation should be performed
# -oi <filename> location of output image with landmarks
# -root <dir> the root directory so -f, -of, -op, and -oi can be specified relative to it
# -inroot <dir> the input root directory so -f can be specified relative to it
# -outroot <dir> the root directory so -of, -op, and -oi can be specified relative to it
#
# Batch image analysis
#
# -fdir <directory> - runs landmark detection on all images (.jpg and .png) in a directory, if the directory contains
# .txt files (image_name.txt) with bounding box (min_x min_y max_x max_y), it will use those for initialisation
# -ofdir <directory> directory where detected landmarks, gaze, and action units should be written
# -oidir <directory> directory where images with detected landmarks should be stored
# -opdir <directory> directory where pose files are output (3D landmarks in images together with head pose and gaze)

exe = "../build/bin/FaceLandmarkImg"

# f_param = './OpenFace/image_sequence/001.jpg'
# of_param = './OpenFace/python/img_output/001.txt'
# op_param = './OpenFace/python/img_output/001_3d.txt'
# oi_param = './OpenFace/python/img_output/001.jpg'
# call([exe, "-f", f_param, "-of", of_param, "-op", op_param, "-oi", oi_param])

fdir_param = './OpenFace/image_sequence/'
ofdir_param = './OpenFace/python/imgseq_output'
oidir_param = ofdir_param
opdir_param = ofdir_param

call([exe, "-fdir", fdir_param, "-ofdir", ofdir_param, "-oidir", oidir_param, "-opdir", opdir_param, "-wild"])

 

Advertisements

9 thoughts on “Installing OpenFace: an open source facial behavior analysis toolkit

    • Yes, FaceLandmarkImg, FaceLandmarkVid, FaceLandmarkVidMulti and FeatureExtraction works for me. For FaceLandmarkVidMulti, try to use the command line example below and see if it works:

      ./bin/FaceLandmarkVidMulti -f ../videos/multi_face.avi

  1. hey i am getting error after running this , could you please help me out ! Thank you so much..

    cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_SHARED_LIBS=OFF ..

    the error goes like this :
    —-after some code—-

    CMake Error at 3rdparty/ippicv/downloader.cmake:77 (message):
    ICV: Failed to download ICV package: ippicv_linux_20151201.tgz.
    Status=56;”Failure when receiving data from the peer”
    Call Stack (most recent call first):
    3rdparty/ippicv/downloader.cmake:110 (_icv_downloader)
    cmake/OpenCVFindIPP.cmake:237 (include)
    cmake/OpenCVFindLibsPerf.cmake:12 (include)
    CMakeLists.txt:537 (include)

    — Configuring incomplete, errors occurred!
    See also “/home/vinay/Downloads/opencv-3.1.0/build/CMakeFiles/CMakeOutput.log”.
    See also “/home/vinay/Downloads/opencv-3.1.0/build/CMakeFiles/CMakeError.log”.

  2. hey Naved , thank u so much
    I succesfully installed and tested with videos,images,multiple images,feature extraction provided in this link ( which u mentioned )
    https://github.com/TadasBaltrusaitis/OpenFace/wiki/Unix-Installation

    I need a small help
    when i used to import openface from python it’s showing traceback error

    >>>
    >>> import sys
    >>>
    >>> import dlib
    >>>
    >>> import cv2
    >>>
    >>> import openface
    Traceback (most recent call last):
    File “”, line 1, in
    ImportError: No module named openface
    >>>
    >>>
    May I know the reason ?
    Thank u so much for your help.

  3. Amit, one easy way to check is to go to the terminal, type python, and enter TAB two times to autocomplete. You’ll see python, python2.7, python3 etc..if you have multiple versions installed, they enter each of the python interface and try to import openface to check which one has been used during openface installation.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s