环境说明:
环境搭建:
2、安装 git 、cmake 、 python-pip
#安装 git
$ sudo apt-get install -y git
# 安装 cmake
$ sudo apt-get install -y cmake
# 安装 python-pip
$ sudo apt-get install -y python-pip
3、安装编译dlib
安装face_recognition这个之前需要先安装编译dlib
(注意中间有个空格)
4、安装 face_recognition
环境搭建完成后,在终端输入 face_recognition 命令查看是否成功
Options:
--cpus INTEGER number of CPU cores to use in parallel (can speed
up processing lots of images). -1 means "use all in
system"
--tolerance FLOAT Tolerance for face comparisons. Default is 0.6.
Lower this if you get multiple matches for the same
person.
--show-distance BOOLEAN Output face distance. Useful for tweaking tolerance
setting.
--help Show this message and exit.
实现人脸识别:
1行代码实现人脸识别示例:
1.首先你需要提供一个文件夹,里面是所有你希望系统认识的人的图片。其中每个人一张图片,图片以人的名字命名:
2.接下来,你需要准备另一个文件夹,里面是你要识别的图片:
linuxmi文件夹下是要识别的图片,其中8.jpg与9.jpg是机器不认识的
3.然后你就可以运行face_recognition命令了,把刚刚准备的两个文件夹作为参数传入,命令就会返回需要识别的图片中都出现了谁:
识别成功。