python 人脸识别

python版本 3.7.0
这里写图片描述

1、 安装 cmake

pip install cmake
这里写图片描述

2、安装 boost

pip install boost
这里写图片描述

3、安装 dlib

pip install dlib
这里写图片描述

4、安装 face_recognition

pip install face_recognition
这里写图片描述

5、验证

face_recognition 本地模型路径 要识别图片路径
输出:文件名 识别的人名
这里写图片描述

注意:文件名以人名命名
这里写图片描述

6、寻找人脸位置

face_detection “路径”
输出:人脸像素坐标
这里写图片描述

7、调整灵敏度

face_recognition –tolerance 灵敏度 本地模型路径 要识别图片路径
注:默认0.6,识别度越低识别难度越高
这里写图片描述

8、计算每次面部距离

face_recognition –show-distance true 本地模型路径 要识别图片路径
这里写图片描述

9、只是想知道每张照片中人物的姓名,却不关心文件名,可以这样做:

face_recognition 本地模型路径 要识别图片路径 | cut -d ‘,’ -f2

这里写图片描述

10、加速识别

face_recognition –cpus 使用内核数 本地模型路径 要识别图片路径
使用四核识别:
face_recognition –cpus 4 本地模型路径 要识别图片路径
这里写图片描述
使用全部内核识别:
face_recognition –cpus -1 本地模型路径 要识别图片路径这里写图片描述

11、自动查找图像中的所有面孔

import face_recognition

image = face_recognition.load_image_file(“吴京.jpg”)
face_locations = face_recognition.face_locations(image)

12、识别图像中的面孔并识别他们是谁

import face_recognition

picture_of_me = face_recognition.load_image_file("me.jpg")
my_face_encoding = face_recognition.face_encodings(picture_of_me)[0]

# my_face_encoding now contains a universal 'encoding' of my facial features that can be compared to any other picture of a face!

unknown_picture = face_recognition.load_image_file("unknown.jpg")
unknown_face_encoding = face_recognition.face_encodings(unknown_picture)[0]

# Now we can see the two face encodings are of the same person with `compare_faces`!

results = face_recognition.compare_faces([my_face_encoding], unknown_face_encoding)

if results[0] == True:
    print("It's a picture of me!")
else:
    print("It's not a picture of me!")

参考地址:
https://github.com/ageitgey/face_recognition#face-recognition

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值