python人脸识别实验报告总结_Python 使用 face_recognition 人脸识别

本文介绍了Python中使用face_recognition库进行人脸识别的方法,包括加载图片、自动查找面部位置、定位面部特征以及识别面部身份。通过简单易懂的代码示例,展示了如何利用face_recognition库进行人脸识别。
摘要由CSDN通过智能技术生成

Python 使用 face_recognition 人脸识别

人脸识别

face_recognition 是世界上最简单的人脸识别库。

使用 dlib 最先进的人脸识别功能构建建立深度学习,该模型准确率在99.38%。

Python模块的使用

Python可以安装导入 face_recognition 模块轻松操作,对于简单的几行代码来讲,再简单不过了。

自动查找图片中的所有面部

import face_recognition

image = face_recognition.load_image_file("my_picture.jpg")

face_locations = face_recognition.face_locations(image)

# face_locations is now an array listing the co-ordinates of each face!

还可以选择更准确的给予深度学习的人脸检测模型

import face_recognition

image = face_recognition.load_image_file("my_picture.jpg")

face_locations = face_recognition.face_locations(image, model="cnn")

# face_locations is now an array listing the co-ordinates of each face!

自动定位图像中人物的面部特征

import face_recognition

image = face_recognition.load_image_file("my_picture.jpg")

face_landmarks_list = face_recognition.face_landmarks(image)

# face_landmarks_list is now an array with the locations of each facial feature in each face.

# face_landmarks_list[0]['left_eye'] would be the location and outline of the first person's left eye.

识别图像中的面部并识别它们是谁

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],

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值