【OpenFace】

article/2025/9/24 18:25:15

OpenFace:

http://cmusatyalab.github.io/openface/

 

 

一、什么是Openface?

 

Openface是一个基于深度神经网络的开源人脸识别系统。该系统基于谷歌的文章FaceNet: A Unified Embedding for Face Recognition and Clustering。Openface是卡内基梅隆大学的 Brandon Amos主导的。

 

官方地址:http://cmusatyalab.github.io/openface/

代码:https://github.com/cmusatyalab/openface

二、Openface环境搭建

系统:Ubuntu 14.04 64位桌面操作系统

参考:http://cmusatyalab.github.io/openface/setup/

1、Ubuntu切换root用户

此处不详述,如果要用普通用户,请自行测试。

参考文章:

http://blog.csdn.net/itas109/article/details/50679251

 

2、安装前准备工作

安装必要的程序,可以用下面的批处理,也可以一个一个的进行安装。

 

[cpp] view plain copy   在CODE上查看代码片派生到我的代码片

  1. #!/bin/sh  
  2. sudo apt-get install build-essential -y  
  3. sudo apt-get install cmake -y  
  4. sudo apt-get install curl -y  
  5. sudo apt-get install gfortran -y  
  6. sudo apt-get install git -y  
  7. sudo apt-get install libatlas-dev -y  
  8. sudo apt-get install libavcodec-dev -y  
  9. sudo apt-get install libavformat-dev -y  
  10. sudo apt-get install libboost-all-dev -y  
  11. sudo apt-get install libgtk2.0-dev -y  
  12. sudo apt-get install libjpeg-dev -y  
  13. sudo apt-get install liblapack-dev -y  
  14. sudo apt-get install libswscale-dev -y  
  15. sudo apt-get install pkg-config -y  
  16. sudo apt-get install python-dev -y  
  17. sudo apt-get install python-pip -y  
  18. sudo apt-get install wget -y  
  19. sudo apt-get install zip –y  

[cpp] view plain copy  在CODE上查看代码片派生到我的代码片

  1. #!/bin/sh  
  2. sudo apt-get install build-essential -y  
  3. sudo apt-get install cmake -y  
  4. sudo apt-get install curl -y  
  5. sudo apt-get install gfortran -y  
  6. sudo apt-get install git -y  
  7. sudo apt-get install libatlas-dev -y  
  8. sudo apt-get install libavcodec-dev -y  
  9. sudo apt-get install libavformat-dev -y  
  10. sudo apt-get install libboost-all-dev -y  
  11. sudo apt-get install libgtk2.0-dev -y  
  12. sudo apt-get install libjpeg-dev -y  
  13. sudo apt-get install liblapack-dev -y  
  14. sudo apt-get install libswscale-dev -y  
  15. sudo apt-get install pkg-config -y  
  16. sudo apt-get install python-dev -y  
  17. sudo apt-get install python-pip -y  
  18. sudo apt-get install wget -y  
  19. sudo apt-get install zip –y  

 

3、安装必要的库

[cpp] view plain copy   在CODE上查看代码片派生到我的代码片

  1. pip2 install numpy scipy pandas  
  2. pip2 install scikit-learn scikit-image  

[cpp] view plain copy  在CODE上查看代码片派生到我的代码片

  1. pip2 install numpy scipy pandas  
  2. pip2 install scikit-learn scikit-image  


注意:

a.如果出现某一个安装失败的情况,可以一个一个的安装

 

b.提高pip安装速度

可以更换pip镜像加快下载速度
建立./pip/pip.conf,输入以下内容(或者其他可用镜像):

[cpp] view plain copy   在CODE上查看代码片派生到我的代码片

  1. [global]  
  2. timeout = 6000  
  3. index-url = http://pypi.douban.com/simple  
  4.   
  5. [install]  
  6. use-mirrors = true  
  7. mirrors = <a target=_blank href="http://pypi.douban.com/">http://pypi.douban.com/</a>  

[cpp] view plain copy  在CODE上查看代码片派生到我的代码片

  1. [global]  
  2. timeout = 6000  
  3. index-url = http://pypi.douban.com/simple  
  4.   
  5. [install]  
  6. use-mirrors = true  
  7. mirrors = <a target=_blank href="http://pypi.douban.com/">http://pypi.douban.com/</a>  

 

c.报错:SSLError: The read operation timed out

可以用下列指令将延时加长

[cpp] view plain copy   在CODE上查看代码片派生到我的代码片

  1. pip2 -install scikit-image --timeout 100  

[cpp] view plain copy  在CODE上查看代码片派生到我的代码片

  1. pip2 -install scikit-image --timeout 100  


 

4、安装Torch

a.安装依赖

[cpp] view plain copy   在CODE上查看代码片派生到我的代码片

  1. curl -shttps://raw.githubusercontent.com/torch/ezinstall/master/install-deps  | bash –e  

[cpp] view plain copy  在CODE上查看代码片派生到我的代码片

  1. curl -shttps://raw.githubusercontent.com/torch/ezinstall/master/install-deps  | bash –e  


 

b.安装

[cpp] view plain copy   在CODE上查看代码片派生到我的代码片

  1. git clone https://github.com/torch/distro.git ~/torch --recursive  
  2. cd ~/torch && ./install.sh  

[cpp] view plain copy  在CODE上查看代码片派生到我的代码片

  1. git clone https://github.com/torch/distro.git ~/torch --recursive  
  2. cd ~/torch && ./install.sh  

 

c.安装依赖

luarocks install $NAME, where $NAME is as listed below.

dpnn

nn

csvigo

cunn (使用CUDA)

fblualib  (仅为了训练DNN)

torchx  (仅为了训练DNN)

 

命令行,按照需要安装:

[cpp] view plain copy   在CODE上查看代码片派生到我的代码片

  1. ~/torch/install/bin/luarocks install dpnn  
  2. ~/torch/install/bin/luarocks install nn  
  3. ~/torch/install/bin/luarocks install optim  
  4. ~/torch/install/bin/luarocks install csvigo  
  5. ~/torch/install/bin/luarocks install cunn  
  6. ~/torch/install/bin/luarocks install fblualib  
  7. ~/torch/install/bin/luarocks install torchx  

[cpp] view plain copy  在CODE上查看代码片派生到我的代码片

  1. ~/torch/install/bin/luarocks install dpnn  
  2. ~/torch/install/bin/luarocks install nn  
  3. ~/torch/install/bin/luarocks install optim  
  4. ~/torch/install/bin/luarocks install csvigo  
  5. ~/torch/install/bin/luarocks install cunn  
  6. ~/torch/install/bin/luarocks install fblualib  
  7. ~/torch/install/bin/luarocks install torchx  

 

d.验证是否安装依赖成功

用th命令验证

 

注意:

a.gitclone更新网络老中断

 

Git submodule update --init –recursive

或者torch目录下的

Update.sh

 

建议用Update.sh解决

 

b.错误:

Cloning into'extra/luaffifb'...

remote:Counting objects: 918, done.

error: RPCfailed; result=56, HTTP code = 200| 0 bytes/s    

fatal: Theremote end hung up unexpectedly

fatal: earlyEOF

fatal:index-pack failed

Clone of 'https://github.com/facebook/luaffifb' intosubmodule path 'extra/luaffifb' failed

解决:

[cpp] view plain copy   在CODE上查看代码片派生到我的代码片

  1. git config --global http.postBuffer 524288000  

[cpp] view plain copy  在CODE上查看代码片派生到我的代码片

  1. git config --global http.postBuffer 524288000  

 

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.指令下载:

[cpp] view plain copy   在CODE上查看代码片派生到我的代码片

  1. cd ~  
  2. mkdir  -p src  
  3. cd  src  
  4. curl  -L https://github.com/Itseez/opencv/archive/2.4.11.zip -o ocv.zip  

[cpp] view plain copy  在CODE上查看代码片派生到我的代码片

  1. cd ~  
  2. mkdir  -p src  
  3. cd  src  
  4. curl  -L https://github.com/Itseez/opencv/archive/2.4.11.zip -o ocv.zip  


 

b.解压:

[cpp] view plain copy   在CODE上查看代码片派生到我的代码片

  1. unzip  ocv.zip  

[cpp] view plain copy  在CODE上查看代码片派生到我的代码片

  1. unzip  ocv.zip  

 

c.编译:

[cpp] view plain copy   在CODE上查看代码片派生到我的代码片

  1. cd  opencv-2.4.11  
  2. mkdir  release  
  3. cd  release  
  4. cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..  
  5. make  -j8  
  6. make  install  

[cpp] view plain copy  在CODE上查看代码片派生到我的代码片

  1. cd  opencv-2.4.11  
  2. mkdir  release  
  3. cd  release  
  4. cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..  
  5. make  -j8  
  6. 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.安装编译

[html] view plain copy   在CODE上查看代码片派生到我的代码片

  1. mkdir -p ~/src  
  2. cd ~/src tar xf dlib-18.16.tar.bz2  
  3. cd dlib-18.16/python_examples  
  4. mkdir build  
  5. cd build  
  6. cmake ../../tools/python  
  7. cmake --build . --config Release  
  8. cp dlib.so /usr/local/lib/python2.7/dist-packages  

[html] view plain copy  在CODE上查看代码片派生到我的代码片

  1. mkdir -p ~/src  
  2. cd ~/src tar xf dlib-18.16.tar.bz2  
  3. cd dlib-18.16/python_examples  
  4. mkdir build  
  5. cd build  
  6. cmake ../../tools/python  
  7. cmake --build . --config Release  
  8. 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.验证

[cpp] view plain copy   在CODE上查看代码片派生到我的代码片

  1. import dlib  

[cpp] view plain copy  在CODE上查看代码片派生到我的代码片

  1. import dlib  

 

7、Git获取openface

a.下载Openface

[cpp] view plain copy   在CODE上查看代码片派生到我的代码片

  1. git clone https://github.com/cmusatyalab/openface.git  
  2. git submodule init  
  3. git submodule update  

[cpp] view plain copy  在CODE上查看代码片派生到我的代码片

  1. git clone https://github.com/cmusatyalab/openface.git  
  2. git submodule init  
  3. git submodule update  

 

b.在Openface根目录执行

[cpp] view plain copy   在CODE上查看代码片派生到我的代码片

  1. sudo python2 setup.py install  

[cpp] view plain copy  在CODE上查看代码片派生到我的代码片

  1. sudo python2 setup.py install  

 

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

[cpp] view plain copy   在CODE上查看代码片派生到我的代码片

  1. import cv2   
  2. import dlib  

[cpp] view plain copy  在CODE上查看代码片派生到我的代码片

  1. import cv2   
  2. import dlib  

 

c.获取模型

[cpp] view plain copy   在CODE上查看代码片派生到我的代码片

  1. models/get-models.sh  

[cpp] view plain copy  在CODE上查看代码片派生到我的代码片

  1. models/get-models.sh  

 

8、运行demo

运行demo1:

./demos/compare.pyimages/examples/{lennon*,clapton*}

运行demo2:

./demos/classifier.py infermodels/openface/celeb-classifier.nn4.small2.v1.pkl ./images/examples/carell.jpg

运行demo3:

./demos/web/start-servers.sh

 

9、demo1可用浏览器

可用浏览器:

360浏览器极速模式

火狐浏览器

搜狗浏览器高速模式

 

不可用浏览器:

Chrome谷歌浏览器(可能与浏览器更新有关系,getUserMedia())

IE览器


Taily老段的微信公众号,欢迎交流学习

https://blog.csdn.net/taily_duan/article/details/81214815


 


http://chatgpt.dhexx.cn/article/ZW5PXP2D.shtml

相关文章

OpenFace

OpenFace是一个包含了landmark&#xff0c;head pose&#xff0c;Actionunions&#xff0c;eye gaze等功能&#xff0c;并包含训练和检测所有源码的开源人脸框架&#xff0c;论文为&#xff0c;OpenFace: an open source facial behavior analysis toolkit OpenFace所用到的库包…

win10下openface快速安装与使用

win10下openface快速安装与使用 情况说明环境下载openface下载模型openface的简单使用 情况说明 我发现openface的安装方法五花八门&#xff0c;大多都比较复杂&#xff0c;而openface分很多版本&#xff0c;很多安装教程混在一起&#xff0c;导致我自己安装时下载下混了。 本…

Windows系统下的Openface安装及使用--亲测有效

一、配置openface所需环境 openface主要依赖于opencv和dlib等工具包&#xff0c;工具包安装可winr进入用户终端下载安装&#xff08;需要先下载python&#xff09;&#xff0c;或者下载ananconda&#xff0c;创建anaconda虚拟环境安装&#xff1a; pip install opencv-python…

OpenFace简介

推荐 如下博文 https://blog.csdn.net/qq_14845119/article/details/53994607 OpenFace是一个包含了landmark&#xff0c;head pose&#xff0c;Actionunions&#xff0c;eye gaze等功能&#xff0c;并包含训练和检测所有源码的开源人脸框架&#xff0c;论文为&#xff0c;Ope…

Openface的安装和使用

openface的安装与使用 环境&#xff1a;我的电脑是笔记本电脑&#xff0c;win10系统&#xff0c;用的是pycharm和annaconda。 一、首先下载openface安装包&#xff0c;并且安装 1.下载地址&#xff1a;https://codeload.github.com/cmusatyalab/openface/zip/master 2.下载后…

OpenFace学习(1):安装配置及人脸比对

前言 前几天在网上看到了openface&#xff08;链接&#xff09;&#xff0c;觉得挺有趣就下载配置了一下&#xff0c;稍微修改了一下跑了个demo&#xff0c;效果还是很不错的。这里分享下安装配置的过程以及demo。 简介 openface是一个基于深度神经网络的开源人脸识别系统&a…

“H5移动端App—数据统计分析”项目展示

1、具有切换商城展示功能 2、通过不同的统计图样式分别展示不同的数据

Vant简单H5 web app【小试牛刀】

index.html <!DOCTYPE html> <html><head><meta charset"utf-8"><!--谷歌浏览器&#xff08;手机端&#xff09;顶部颜色--><meta name"msapplication-TileColor" content"#4183fd"><meta name"the…

推荐几个H5、app制作开发工具

我们已经进入移动互联网时代&#xff0c;而app是移动互联网的载体。传统app开发面临成本高、周期长等问题&#xff0c;因此各类快速生成app的工具层出不穷。企业拥有了app才能实现互联网营销和互联网推广。中国有近7000万传统中小型企业&#xff0c;app会帮助这些企业实现互联网…

直接复制php代码制作app,一套免费无代码在线制作APP工具,将APP打包带走

线上营销的火爆离不开人们对APP的依赖&#xff0c;许多小商户已经从很早的时候就开始萌芽出制作APP来为实体店增加生意的想法&#xff0c;然后开发APP对中型企业都是一件成本极高的事情&#xff0c;即便小商户请外包团队需求降到最低&#xff0c;也会产生十几万的费用&#xff…

如何快速成为APP制作、H5制作高手?

App、H5无疑是移动互联网时代的宠儿&#xff0c;无数社交、商业、宣传都在App、H5上实现。掌握App、H5制作技能&#xff0c;无论工作、学习&#xff0c;更胜人一筹。 那么&#xff0c;什么是App呢&#xff1f; App(application的缩写)&#xff0c;即安装在手机上的软件。早期的…

uni-app跨端开发实现APP与H5之间的通讯和交互

最近在研究uni-app跨端开发APP和H5的通讯和交互&#xff0c;比如H5调用APP的方法&#xff0c;APP往H5里面传参&#xff0c;H5往app外面传参。话不多说&#xff0c;上代码&#xff01; html文件放本地的话必须放在项目根目录下的static文件夹 H5调用APP的方法 <!DOCTYPE ht…

利用H5+实现APP在线更新

1 在APP首页添加以下js代码 // 获取本地应用资源版本号 plus.runtime.getProperty(plus.runtime.appid,function(inf){wgtVer inf.version; // mui.toast("当前应用版本&#xff1a;"wgtVer);// 检测更新checkUpdate(); });// 检测更新 var checkUrl "能够返…

uniapp常用打包记录【h5、app、wx小程序】

h5打包 打包前配置 开始打包 打包成功 h5打包之后&#xff0c;如果用的unicloud开发&#xff0c;可以直接上传到“前端网页托管”&#xff0c;然后系统会有个默认域名&#xff0c;我们就可以实现公网访问了 h5的调试工具“vConsole” 参考&#xff1a; (160条消息) vue3 移动端…

H5加壳APP发布Android、IOS应用(证书响应文件制作)

主要步骤&#xff1a; 1.申请一个苹果账号 2.申请ios测试证书&#xff08;p12&#xff09; 3.申请ios描述文件&#xff08;mobileprovision&#xff09; 4.打包ipa 5.安装ipa 一、申请苹果账号 也可以用我注册好的苹果账号体验下&#xff0c;新注册个也简单&#xff0c;…

H5页面的部分IOS兼容处理

IOS兼容处理 环境&#xff1a;uni-app开发H5项目&#xff0c;H5项目链接webview嵌入app中 popup弹窗显示层级问题 问题&#xff1a;遮罩层遮挡位置不正确有白边&#xff0c;提交按钮应该在最底部却显示在popup上面 解决&#xff1a;将popup组件放到外层组件中&#xff0c;避免…

html app启动页制作,【示例】App引导页的制作

注意:本文为5+App的引导页制作方法,uni-app另行制作,推荐使用nvue制作,也可以参考插件市场已经封装的插件https://ext.dcloud.net.cn/plugin?id=192 启动页和引导页 首先澄清一下“启动界面”(splash)和“引导页”(guide)的概念,因为许多刚接触App开发的朋友会搞不清楚这…

H5+app -- 自动更新

一、最近做了一个app自动更新功能&#xff0c;用的基本都是网上找得到的。 1、h5 规范 &#xff1a; http://www.html5plus.org/doc/zh_cn/maps.html 2、环形进度条插件&#xff1a;http://www.jq22.com/jquery-info4495&#xff08;不知道什么原因&#xff0c;下载的时候&…

html5页面和app的区别,H5页面与APP区别何在

APP相信大家都非常熟悉&#xff0c;就是手机里经常安装的软件程序&#xff0c;它都需要经过下载安装的步骤才能打开产品进行操作。不过H5页面和APP却有比较大的区别&#xff0c;它不需要经过下载安装&#xff0c;直接能够在浏览器和微信等社交平台中打开操作。 APP的制作一般都…

uni-app消息推送功能实现

1&#xff0c;首先可以简单的看一下HTML5 API文档了解一下对应的方法 HTML5API&#xff1a;https://www.html5plus.org/doc/zh_cn/push.html#plus.push.MessageOptions 2&#xff0c;先在manifest.json勾选一下Push推送 3&#xff0c; 需要配置一下并传给后端 4&#xff0c;可…