【问题标题】:face_recognition.compare_faces return only falseface_recognition.compare_faces 只返回 false
【发布时间】:2021-05-12 10:40:49
【问题描述】:

我想制作一个脚本来获取面部图像并返回它在其中找到的数据集中的所有图像。 我保存了数据集中所有图像的编码并将其加载到列表中:

dataEncodingsList = [d["encoding"] for d in data]

比我还对要搜索的人脸图像进行编码:

imageEncodings = face_recognition.face_encodings(image, boxes)

然后我尝试在编码之间进行比较:

for encoding in imageEncodings:
        # attempt to match each face in the input image to our known encodings
        matches = face_recognition.compare_faces(dataEncodingsList,
            encoding[0],tolerance=0.6)

但它无法识别任何图像。我试图上下改变容差,但没有帮助。 我打印了 compare_faces 的返回值,结果只有“false”:

print (matches)
=>  [False, False, False, False, False, False, False, False, False, False, False, False, False, False, ..., False]

有人可以帮忙吗?

【问题讨论】:

  • 你降低tolerance的结果是不是也一样?
  • 是的,即使我尝试公差 = 0.1.... 并且有很多这张脸的照片
  • 我也面临同样的情况

标签: python-3.x opencv cv2 face-recognition


【解决方案1】:

添加for循环以检查编码列表中的编码

for encoding in imageEncodings:
    for j in range(len(dataEncodingsList)):
        matches = face_recognition.compare_faces(dataEncodingsList,encoding,tolerance=0.6)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-04-07
    • 2011-04-05
    • 2020-07-23
    相关资源
    最近更新 更多