face_recognition是一个强大、简单、易上手的人脸识别开源项目,并且配备了完整的开发文档和应用案例,特别是兼容树莓派系统。非常最简洁的人脸识别库,使用和安装都非常简单,可以使用Python/ target=_blank class=infotextkey>Python和命令行工具提取、识别、操作人脸。
开源:https://github.com/ageitgey/face_recognition
安装
pip3 install face_recognition
样例代码
import face_recognition
# 检测
image = face_recognition.load_image_file("your_file.jpg")
face_locations = face_recognition.face_locations(image)
# 关键点
image = face_recognition.load_image_file("your_file.jpg")
face_landmarks_list = face_recognition.face_landmarks(image)
# 识别
known_image = face_recognition.load_image_file("biden.jpg")
unknown_image = face_recognition.load_image_file("unknown.jpg")
biden_encoding = face_recognition.face_encodings(known_image)[0]
unknown_encoding = face_recognition.face_encodings(unknown_image)[0]
results = face_recognition.compare_faces([biden_encoding], unknown_encoding)