Skip to content

Instantly share code, notes, and snippets.

@jaypei
Forked from lxxstc/openface demos test.md
Created December 4, 2017 06:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaypei/d2c6278cd2dde5d6c9145b530a28346e to your computer and use it in GitHub Desktop.
Save jaypei/d2c6278cd2dde5d6c9145b530a28346e 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

注意: 将install-deps里面 make install 前的sudo去掉,不需要做sudo权限,其他按照文档照搬

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