安装Openface,实现人脸比对

本文详细介绍了如何安装Python中常用的计算机视觉库,包括OpenCV、dlib和OpenFace等,并提供了具体的步骤指导。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

安装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

安装第三方依赖

sudo apt-get install build-essential
sudo apt-get install cmake 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
mkdir release

cd 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




返回结果数值越小,代表两张人脸越接近。


评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值