python - 使用 OpenCV 和 Keras 进行人脸比较(不是识别或检测)?

标签 python opencv neural-network convolution face-recognition

首先这是我的github link for the question .

这是我的问题:

我想用 Python 做一个人脸比较功能。我可以使用 OpenCV 成功(?)识别人脸。现在,我该如何进行比较

我的理解是这样的:

在一般的机器学习方法中,我需要收集有关该特定人的大量数据并使用 CNN 对其进行最终确定。

但是,我只有 2 张图片,我该如何进行比较?我应该根据分类还是聚类(使用 KNN)来考虑它?

非常感谢您的帮助。

最佳答案

您可以使用人脸嵌入的想法,例如在高引用论文 FaceNet 中提出的并在 OpenFace 中实现(也经过预训练)。

总体思路:采用一些预处理的人脸(正面,裁剪,...)并将其嵌入到具有特征的较低维度,即输入中的相似人脸在输出中应该具有低欧几里得距离。

因此在您的情况下:使用嵌入 CNN 将您的面孔映射到缩小空间(通常是大小为 128 的向量)并计算欧几里得空间中的距离。当然你也可以聚类面孔,但这不是你的任务。

除了一般的想法之外,这里的好处是: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 .

关于python - 使用 OpenCV 和 Keras 进行人脸比较(不是识别或检测)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46168182/

相关文章:

python - 部署 python 可执行文件 - PyInstaller、cx-freeze 等

python - 应用程序需要一个文件系统元数据层

c++ - cv::Scalar 类型是什么意思?

c++ - cv::Mat 的 deallocate 方法有什么作用?

c++ - 在opencv中复制Mat

machine-learning - 自动编码器可以用于重建非二进制向量吗?

python - 如何仅将列 pandas python 中的科学值转换为 int

python - 如何从头开始构建具有可变属性的xml模板

python - 以图像作为标签的 Caffe 测试网

python - 使用 cifar 100 的图像分类器,训练精度没有增加