ubuntu16.04.3环境下搭建open face (一)

本文详细介绍了在Ubuntu 14.04系统上搭建OpenFace环境的步骤,包括安装必备软件、库、Torch、OpenCV、dlib以及获取和运行OpenFace模型的全过程。

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

一、Openface环境搭建

系统:Ubuntu 14.04 64位桌面操作系统
参考:http://cmusatyalab.github.io/openface/setup/
1、Ubuntu切换root用户

此处不详述,如果要用普通用户,请自行测试。
参考文章:
http://blog.youkuaiyun.com/itas109/article/details/50679251

2、安装前准备工作

安装必要的程序,可以用下面的批处理,也可以一个一个的进行安装。
sudo apt-get install build-essential -y
sudo apt-get install cmake -y
sudo apt-get install curl -y
sudo apt-get install gfortran -y
sudo apt-get install git -y
sudo apt-get install libatlas-dev -y
sudo apt-get install libavcodec-dev -y
sudo apt-get install libavformat-dev -y
sudo apt-get install libboost-all-dev -y
sudo apt-get install libgtk2.0-dev -y
sudo apt-get install libjpeg-dev -y
sudo apt-get install liblapack-dev -y
sudo apt-get install libswscale-dev -y
sudo apt-get install pkg-config -y
sudo apt-get install python-dev -y
sudo apt-get install python-pip -y
sudo apt-get install wget -y
sudo apt-get install zip –y

3、安装必要的库
pip2 install numpy scipy pandas
pip2 install scikit-learn scikit-image

4、安装Torch

a.安装依赖
curl -s https://raw.githubusercontent.com/torch/ezinstall/master/install-deps | bash -e

b.安装
git clone https://github.com/torch/distro.git ~/torch –recursive
cd ~/torch && ./install.sh

c.安装依赖
命令行,按照需要安装:
~/torch/install/bin/luarocks install dpnn
~/torch/install/bin/luarocks install nn
~/torch/install/bin/luarocks install optim
~/torch/install/bin/luarocks install csvigo
~/torch/install/bin/luarocks install cunn
~/torch/install/bin/luarocks install fblualib
~/torch/install/bin/luarocks install torchx

d.验证是否安装依赖成功
用th命令验证

5、安装opencv

opencv版本为2.4.11,下载地址:https://github.com/Itseez/opencv/archive/2.4.11.zip
编译参考:http://docs.opencv.org/2.4/doc/tutorials/introduction/linux_install/linux_install.html

a.指令下载:
cd ~
mkdir -p src
cd src
curl -L https://github.com/Itseez/opencv/archive/2.4.11.zip -o ocv.zip

b.解压:
[cpp] view plain copy
unzip ocv.zip

c.编译:
[cpp] view plain copy
cd opencv-2.4.11
mkdir release
cd release
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
make -j8
make install

d.验证
import cv2

6、安装dlib

dlib v18.16下载地址:https://github.com/davisking/dlib/releases/download/v18.16/dlib-18.16.tar.bz2

a.安装编译
mkdir -p ~/src
cd ~/src tar xf dlib-18.16.tar.bz2
cd dlib-18.16/python_examples
mkdir build
cd build
cmake ../../tools/python
cmake –build . –config Release
cp dlib.so /usr/local/lib/python2.7/dist-packages

b.确保
在a中最后一条命令中,确保路径在默认的Python路径,可以在Python解释器里面用sys.path查找
For the final command, make sure the directory is in your default Python path, which can be found withsys.path in a Python interpreter.

c.验证
import dlib

7、Git获取openface

a.下载Openface
git clone https://github.com/cmusatyalab/openface.git
git submodule init
git submodule update

b.在Openface根目录执行
sudo python2 setup.py install

python2一定要确保dlib和opencv安装成功
import cv2
import dlib

c.获取模型
models/get-models.sh

8、运行demo

运行demo1:
./demos/compare.py images/examples/{lennon*,clapton*}
运行demo2:
./demos/classifier.py infer models/openface/celeb-classifier.nn4.small2.v1.pkl ./images/examples/carell.jpg
运行demo3:
./demos/web/start-servers.sh

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值