|
| 1 | +# How to install OpenFace (required by engagement tracking service) |
| 2 | + |
| 3 | +* Download the code from https://github.com/TadasBaltrusaitis/OpenFace |
| 4 | +* Copy all file into tools/OpenFace BUT DON'T OVERWRITE EXISTING FILES |
| 5 | + |
| 6 | +* For platform specific build instructions, see https://github.com/TadasBaltrusaitis/OpenFace/wiki |
| 7 | +* OpenFace Requirements: |
| 8 | + * boost (install via package manager) |
| 9 | + * TBB (install via package manager) |
| 10 | + * dlib (install via package manager) |
| 11 | + * OpenBLAS (install via package manager) |
| 12 | + * wget (install via package manager) |
| 13 | + * opencv-4.1.0 (install via package manager / dowload source from https://github.com/opencv/opencv/archive/4.1.0.zip) |
| 14 | + * together with opencv_contrib-4.1.0 (install via package manager / download source from https://github.com/opencv/opencv_contrib/archive/4.1.0.zip) |
| 15 | + * Tip for Mac homebrew users to obtain correct version: |
| 16 | + * activate your python virtual environment |
| 17 | + * in your terminal, execute `brew edit opencv@` |
| 18 | + * change the url in the line starting with `url "http://https://github.com/opencv/opencv/archive/..".` to `url "https://github.com/opencv/opencv/archive/4.1.0.tar.gz"` |
| 19 | + * change the line underneath starting with `sha256 "..."` to `sha256 "8f6e4ab393d81d72caae6e78bd0fd6956117ec9f006fba55fcdb88caf62989b7"` |
| 20 | + * scroll to the line `resource "contrib" do`` |
| 21 | + * change the line underneath starting with `url "https://github.com/opencv/opencv_contrib/archive/...."` to `url "https://github.com/opencv/opencv_contrib/archive/4.1.0.tar.gz"` |
| 22 | + * change the line underneath starting with `sha256 "..."` to `sha256 "e7d775cc0b87b04308823ca518b11b34cc12907a59af4ccdaf64419c1ba5e682"` |
| 23 | + * scroll down to the `args` section |
| 24 | + * change `-DWITH_QT=OFF` to `-DWITH_QT=ON` |
| 25 | + * add a new line with `-DBUILD_TBB=ON` |
| 26 | + * in your terminal, execute `brew install opencv@` - this will install opencv-4.1.0 |
| 27 | + * update `tools/OpenFace/CMakeLists.txt` |
| 28 | + * change line `find_package( OpenCV 4.0 REQUIRED COMPONENTS core imgproc calib3d highgui objdetect` to `find_package( OpenCV 4.0 REQUIRED COMPONENTS core imgproc calib3d highgui objdetect HINTS /usr/local/Cellar/opencv/4.1.0)` (or if your homebrew installs somewhere else, use this path instead for the `HINTS`) |
| 29 | + * qt4 (install via official installer / package manager) |
| 30 | + * For Mac homebrew users: `brew install cartr/qt4/pyqt@4` |
| 31 | +* Build OpenFace: |
| 32 | + * `cd tools/OpenFace` |
| 33 | + * `mkdir build` |
| 34 | + * `cd build` |
| 35 | + * `cmake -D CMAKE_BUILD_TYPE=RELEASE ..` |
| 36 | + * `make` or `make -jx` where `x` is the number of parallel jobs (e.g. if you have 4 CPU's calling `make -j4` should be faster than `make`) |
| 37 | +* After-Build: |
| 38 | + * `cd .. ` brings you back to the OpenFace main folder. |
| 39 | + * `sh download_models.sh` |
| 40 | + * NOTE: the following paths assume `tools/OpenFace` as your current folder |
| 41 | + * check that `build/bin/model/patch_experts` contains `cen_patches_*.dat` files. If not, copy them from `lib/local/LandmarkDetector/model/patch_experts` |
| 42 | + * copy `lib/local/3rdParty/OpenCV/classifiers` to `build/bin` |
| 43 | + * verify installation by running `./tools/OpenFace/build/bin/FaceLandmarkVid -device 0` (or replace 0 with the desired camera device number) |
| 44 | + |
| 45 | + |
| 46 | + |
| 47 | +OLD - ignore |
| 48 | +<!-- OpenFace` |
| 49 | +* requirements` |
| 50 | +* mkdir build |
| 51 | +* cd build |
| 52 | +* call CMake: |
| 53 | + (Example config: fill in qt path, extra_modules_path): |
| 54 | + cmake -D CMAKE_BUILD_TYPE=RELEASE \ |
| 55 | + -D WITH_TBB=ON \ |
| 56 | + -D WITH_V4L=ON \ |
| 57 | + -D OPENCV_SKIP_PYTHON_LOADER=ON \ |
| 58 | + -D CMAKE_PREFIX_PATH=/usr/local/opt/qt5 \ |
| 59 | + -D CMAKE_MODULE_PATH="$QT5PATH"/lib/cmake \ |
| 60 | + -D OPENCV_PYTHON3_INSTALL_PATH=~/.virtualenvs/OpenCV-"$cvVersion"-py3/lib/python3.7/site-packages \ |
| 61 | + -D WITH_QT=ON \ |
| 62 | + -D WITH_OPENGL=ON \ |
| 63 | + -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-4.1.0/modules \ |
| 64 | + -D BUILD_EXAMPLES=OFF .. |
| 65 | +* make --> |
0 commit comments