微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

将yolov4人脸检测与face_recognition一起使用

如何解决将yolov4人脸检测与face_recognition一起使用

我可以使用yolov4进行对象检测并使用face_recognition库识别检测到的面部,还是需要使用face_recognition库提供的面部检测才能使用其面部识别?

解决方法

face_recognition库使用dlib的内置算法专门用于面部检测。据称精度为99%+。您不能将该算法更改为YoloV4或其他任何算法。

用于face_recognition的网络体系结构基于ResNet-34,但层数更少,过滤器数量减少了一半。对网络进行了训练,该数据集包含“狂野标签”(LFW)数据集中的300万张图像。

请参阅有关基于深度学习的面部识别如何工作的文章Davis King(dlib的创建者)和Adam Geitgey(face_recognition的作者)的文章:

High Quality Face Recognition with Deep Metric Learning

Modern Face Recognition with Deep Learning

但是,如果这还不足以满足您的情况,您可以训练YoloV4来检测面部,然后在检测后裁剪该面部并将其作为输入作为face_recognition库。

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!")

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。