Skip to content

Instantly share code, notes, and snippets.

@lxxstc
Last active December 4, 2017 10:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save lxxstc/1dbc4923633673477fe156db3c5c5f85 to your computer and use it in GitHub Desktop.
Save lxxstc/1dbc4923633673477fe156db3c5c5f85 to your computer and use it in GitHub Desktop.

系统Ubuntu

参考文档

克隆工程

$ git clone 	https://github.com/cmusatyalab/openface
$ cd openface

安装依赖

# 将安装命令换成下面这个
$ env PREFIX=/home/lxxstc/local/ bash install-deps

注意:

  1. 将install-deps里面 make install 前的sudo去掉,不需要做sudo权限
  2. 另外不要让他更新自己的lua环境,将source $PREFIX/torch/install/bin/torch-activate 注入那段去掉。这段环境替换可以放到virtualenv的activate里面去
  • 安装torch依赖,或者说是lua模块
$ luarocks install nn
$ luarocks install dp
  • 安装ffmpeg, 示例demos/sphere.py会用到
$ sudo apt install ffmpeg -y
  • 安装python-opencv,记得不能用pip安装,因为pip安装的opencv-python是没有ffmpeg支持的。见文档
$ sudo apt install python-opencv
  • 初始化一个 virtualenv环境,这里注意,为了能让demos/sphere.py测试成功,需要试用系统已经安装好的python-opencv
$ virtualenv --system-site-packages .venv
$ . .venv/bin/activate
  • 安装Python依赖,有些requirements.txt缺了,所以手动安装吧
$ pip install -r requirements.txt
$ pip install matplotlib
$ pip install dlib
$ python setup.py install
$ pip install -U   pyasn1 # web应用demo用得着 TLS用的
  • 下载模型
$ models/get-models.sh

测试

  • 启动人脸识别
$ python demos/sphere.py --networkModel ./models/openface/nn4.small2.v1.t7  --verbose
  • 人脸图片对比
$ ./demos/compare.py images/examples/{clapton-1.jpg,clapton-2.jpg}
  • 本地启动web demos 由于web demo是https(我看老版tag是是http的),所以需要让浏览器试用insecure方式启动才能使用带TLS的websocket。见文档
$ google-chrome-stable --unsafely-treat-insecure-origin-as-secure="localhost"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment