我是否可以使用yolov4进行对象检测并使用face_recognition库来识别检测到的人脸,或者我是否需要使用face_recognition库提供的人脸检测才能使用其人脸识别?
发布于 2020-11-03 01:10:39
face_recognition库使用dlib专用于人脸检测的内置算法。它声称精度为99%+。您不能将该算法更改为YoloV4或任何其他算法。
face_recognition的网络架构基于ResNet-34,但层更少,过滤器的数量减少了一半。该网络是在一个包含300万张图像的数据集上进行训练的,这些图像来自野外(LFW)数据集中经过标记的人脸。
看看戴维斯·金(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!")https://stackoverflow.com/questions/64648078
复制相似问题