使用 OpenCV 和 Keras 进行人脸比较(不是识别或检测)?
Face comparison (Not recognition or detection) using OpenCV and Keras?
首先是我的github link for the question。
这是我的问题:
我想用Python做一个人脸比较功能。我可以使用 OpenCV 成功(?)识别人脸。现在,我该如何进行比较?
我的理解是这样的:
在一般的机器学习方法中,我需要收集有关该特定人的大量数据并使用 CNN 对其进行最终确定。
但是,我只有2张图片,如何进行比较?我应该从分类还是聚类的角度来考虑它(使用 KNN)?
非常感谢您的帮助。
您需要学习人脸相似度度量。它将允许提取特征以区分不同的人。然后您将能够找到它们之间的差异(距离)。例如,您可以更详细地阅读 here。 kNN 之类的东西对于找到一组相似的面孔很有用,但它需要使用之前提取的特征。
您可以使用人脸嵌入的想法,例如在高引用论文 FaceNet and implemented in OpenFace(也经过预训练)中提出的。
总体思路:采用一些预处理的人脸(正面,裁剪,......)并将其嵌入到具有特征的较低维度,即输入中的相似面孔在输出中应该具有低欧氏距离。
所以在你的情况下:使用嵌入-CNN 将你的脸映射到减少的 space(通常是大小为 128 的向量)并计算距离,如 euclidean-space。当然你也会聚类人脸,但这不是你的任务。
除了总体思路之外,这里的好处是:openface 是一个很好的实现,随时可用,它的主页也解释了这个想法:
Use a deep neural network to represent (or embed) the face on a 128-dimensional unit hypersphere.
The embedding is a generic representation for anybody's face. Unlike other face representations, this embedding has the nice property that a larger distance between two face embeddings means that the faces are likely not of the same person.
This property makes clustering, similarity detection, and classification tasks easier than other face recognition techniques where the Euclidean distance between features is not meaningful.
他们甚至有一个比较演示 here。
使用face_recognition 库(比较面部特征)。它将比较面部特征的编码并在 return.
中为您提供布尔值
首先是我的github link for the question。
这是我的问题:
我想用Python做一个人脸比较功能。我可以使用 OpenCV 成功(?)识别人脸。现在,我该如何进行比较?
我的理解是这样的:
在一般的机器学习方法中,我需要收集有关该特定人的大量数据并使用 CNN 对其进行最终确定。
但是,我只有2张图片,如何进行比较?我应该从分类还是聚类的角度来考虑它(使用 KNN)?
非常感谢您的帮助。
您需要学习人脸相似度度量。它将允许提取特征以区分不同的人。然后您将能够找到它们之间的差异(距离)。例如,您可以更详细地阅读 here。 kNN 之类的东西对于找到一组相似的面孔很有用,但它需要使用之前提取的特征。
您可以使用人脸嵌入的想法,例如在高引用论文 FaceNet and implemented in OpenFace(也经过预训练)中提出的。
总体思路:采用一些预处理的人脸(正面,裁剪,......)并将其嵌入到具有特征的较低维度,即输入中的相似面孔在输出中应该具有低欧氏距离。
所以在你的情况下:使用嵌入-CNN 将你的脸映射到减少的 space(通常是大小为 128 的向量)并计算距离,如 euclidean-space。当然你也会聚类人脸,但这不是你的任务。
除了总体思路之外,这里的好处是:openface 是一个很好的实现,随时可用,它的主页也解释了这个想法:
Use a deep neural network to represent (or embed) the face on a 128-dimensional unit hypersphere.
The embedding is a generic representation for anybody's face. Unlike other face representations, this embedding has the nice property that a larger distance between two face embeddings means that the faces are likely not of the same person.
This property makes clustering, similarity detection, and classification tasks easier than other face recognition techniques where the Euclidean distance between features is not meaningful.
他们甚至有一个比较演示 here。
使用face_recognition 库(比较面部特征)。它将比较面部特征的编码并在 return.
中为您提供布尔值