使用opencvc++对相同的面孔进行分组

group same faces using opencv c++

本文关键字:面孔 opencvc++ 使用      更新时间:2023-10-16

我试图在使用opencv的文件夹组面孔。

我在http://docs.opencv.org/modules/contrib/doc/facerec/facerec_tutorial.html上玩特征脸的例子。但是我找不到任何东西来解决我的问题。

I have a set of faces in my face database: A,B,C,D,E,F,G,H,I
As a result I try to get; 
 - A,B,D are person1
 - C,E,F are person2 
 - G,H   are person3
 - I     is person4

我认为这个过程应该是这样的;

sampleFace = A
while  
  mode.train(faces,labels) // trains face database 
  model.predict(sampleFace, &predict, &confidence) // get the prediction 
  using the confidence and similarity percentage decide A,B,D faces are person1
  remove A,B,D from face database and remove the labels of these images also 
  if faces.size=1 exit loop
  sampleFace = C
end of loop

为了得到这个结果,我认为我需要在特征面样本中为我的模型设置一个阈值。并且需要使用置信度值。

实际上我想设置一个类似%80的相似度分数,然后我想获得与给定样本面部相似度分数大于%80的图像。特征脸样本只给出一张具有置信度值的相似脸。我需要得到多个面孔,每个面孔都有置信度值,然后我可以比较相似性得分。同样,在特征面样本中,我不知道置信度的限制,我需要每个面孔的百分比值。

任何帮助,建议,或代码示例将不胜感激。

你正在尝试的方法是基于无监督学习的,这在人脸图像上效果不佳。如果每个人有足够多的样本,你最好用至少一张人的图像来训练一个分类器;然后为数据集中的每个图像找到最接近的类。