【⼈脸】OpenFace安装教程ubuntu16.04+CUDA9.0
⾸先,下载模型⽂件,这⾥需要下载:
下载完后放到对应的⽂件夹内:
把12个.mat⽂件存放到:/home/username/OpenFace/matlab_version/models/cen下即可
把4个.dat⽂件存放到:/home/username/OpenFace/build/lib/local/LandmarkDetector/model/patch_experts即可
两种⽅式安装
⼀、脚本安装
sudo bash ./install.sh
⼆、⼿动安装
1、更新GCC (ubuntu16.04)
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
sudo apt-get -y update
sudo apt-get update
sudo apt-get install build-enssential
sudo apt-get install g++-8
2、cmake
sudo apt-get install cmake
如果是ubuntu16.04的操作系统,Cmake的版本要求⾄少是3.8以上,ubuntu16.04的apt-get的Cmake版本默认是3.5,下载更新的Cmake版本如下:
sudo apt-get --purge remove cmake-qt-gui -y
sudo apt-get --purge remove cmake -y
mkdir -p cmake_tmp
cd cmake_tmp
wget /files/v3.10/cmake-3.10.
tar -xzvf cmake-3.10. -qq
cd cmake-3.10.1/
ubuntu安装教程./bootstrap
make -j4
sudo make install
cd ../..
sudo rm -rf cmake_tmp
3、安装OpenBLAS
sudo apt-get install libopenblas-dev
4、下载并编译OpenCV4.1.0
安装
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 libdc1394-22-dev
解压
sudo unzip 4.1.0.zip
cd opencv-4.1.0
mkdir build
cd build
编译
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_TIFF=ON -D WITH_TBB=ON .. make -j2
sudo make install
由于后续我⼜下了OpenCV3,也没有出什么问题
5、安装并编译dlib
wget dlib/files/dlib-19.13.tar.bz2;
tar xf dlib-19.13.tar.bz2;
cd dlib-19.13;
mkdir build;
cd build;
cmake ..;
cmake --build . --config Release;
sudo make install;
sudo ldconfig;
cd ../..;
6、下载boost
sudo apt-get install libboost-all-dev
7、下载OpenFace
8、创建⼀个编译路径,编译
cd OpenFace
mkdir build
cd build
cmake -D CMAKE_CXX_COMPILER=g++-8 -D CMAKE_C_COMPILER=gcc-8 -D CMAKE_BUILD_TYPE=RELEASE ..
make
三、测试
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"
for webcam
./bin/FaceLandmarkVid -device 0