安装Python基础类库
pip install numpy scipy pandas
pip install scikit-learn scikit-image
显示已安装类库执行命令pip list
安装OpenCV 2.4.11
安装文档
http://docs.opencv.org/2.4/doc/tutorials/introduction/linux_install/linux_install.html
下载源代码
https://github.com/opencv/opencv/archive/2.4.11.zip
unzip opencv-2.4.11.zip
cd opencv-2.4.11
安装第三方依赖
mkdir releasecd release
cmake -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/usr/local -DCUDA_GENERATION=Kelper ..
禁用CUDA,-DWITH_CUDA=NO
make -j8
sudo make install
验证opencv
安装dlib
下载https://github.com/davisking/dlib/releases/download/v18.16/dlib-18.16.tar.bz2
tar xf dlib-18.16.tar.bz2
cd dlib-18.16/python_examples
mkdir build
cd build
cmake ../../tools/python
cmake --build . --config Release
sudo cp dlib.so /usr/local/lib/python2.7/dist-packages
验证dlib
安装Torch (luajit方式)
git clone https://github.com/torch/distro.git --recursive
mv distro torch
cd torch
bash install-deps
./install.sh
另外一种安装方式,使用lua代替luajit
git clone https://github.com/torch/distro.git --recursive
mv distro torch
cd torch
./clean.sh
TORCH_LUA_VERSION=LUA52 ./install.sh
运行torch
source ~/.bashrc
th
退出torch
os.exit()
安装torch第三方依赖,通过lua的包管理工具安装
luarocks install dpnn nn optim optnet csvigo cutorch cunn fblualib torchx tds
显示已安装包luarocks list
安装OpenFace
git clone https://github.com/cmusatyalab/openface.git
sudo python setup.py install
models/get-models.sh #下载训练好的模型数据
测试
从网上下载5张照片
f1.jpg
f2.jpg
f3.jpg
l1.jpg
l2.jpg
./demo/compare.py images/examples/f1.jpg images/examples/f2.jpg
./demo/compare.py images/examples/f1.jpg images/examples/f3.jpg
/demo/compare.py images/examples/f1.jpg images/examples/l1.jpg
./demo/compare.py images/examples/f1.jpg images/examples/l2.jpg
返回结果数值越小,代表两张人脸越接近。