4

在大多数人脸识别SDK中,它只提供了两大功能

  1. 检测人脸并从照片中提取模板,这称为检测。
  2. 比较两个模板并返回相似的分数,这称为识别。

然而,除了这两个功能之外,我正在寻找的是一种算法或 SDK,用于将具有相似面孔的照片分组在一起,例如基于相似的分数。

谢谢

4

1 回答 1

2

首先,执行步骤 1 以提取模板,然后通过对所有可能的对应用步骤 2,将每个模板与所有其他模板进行比较,获得它们的相似度分数。

根据此相似性分数对匹配进行排序,确定阈值并将超过该阈值的模板组合在一起。

举个例子:

十个模板: A、B、C、D、E、F、G、H、I、J。
分数在: 0 到 100之间。
相似度阈值: 80。

相似度表:

   A   B   C   D   E   F   G   H   I   J
A  100 85  8   0   1   50  55  88  90  10

B  85  100 5   30  99  60  15  23  8   2 

C  8   5   100 60  16  80  29  33  5   8

D  0   30  60  100 50  50  34  18  2   66

E  1   99  16  50  100 8   3   2   19  6

F  50  60  80  50  8   100 20  55  13  90

G  55  15  29  34  3   20  100 51  57  16

H  88  23  33  18  2   55  51  100 8   0

I  90  8   5   2   19  13  57  8   100 3

J  10  2   8   66  6   90  16  0   3   100

排序匹配列表:

AI 90
FJ 90
BE 99
AH 88
AB 85
CF 80
------- <--阈值截止线
DJ 66
......

遍历列表直到阈值截止点,其中值不再超过它,维护完整的模板集和每个模板的关联集,获得最终组:

// Empty initial full templates set
fullSet = {};

// Iterate through the pairs list
foreach (templatePair : pairList)
{
  // If the full set contains the first template from the pair
  if (fullSet.contains(templatePair.first))
  {
     // Add the second template to its group
     templatePair.first.addTemplateToGroup(templatePair.second);

     // If the full set also contains the second template
     if (fullSet.contains(templatePair.second))
     {
        // The second template is removed from the full set
        fullSet.remove(templatePair.second);

        // The second template's group is added to the first template's group
        templatePair.first.addGroupToGroup(templatePair.second.group);
     }
  }
  else
  {
    // If the full set contains only the second template from the pair
    if (fullSet.contains(templatePair.second))
    {
      // Add the first template to its group
      templatePair.second.addTemplateToGroup(templatePair.first);
    }
  }
  else
  {
     // If none of the templates are present in the full set, add the first one
     // to the full set and the second one to the first one's group
     fullSet.add(templatePair.first);
     templatePair.first.addTemplateToGroup(templatePair.second);
  } 
}

清单上的执行细节:

AI: fullSet.add(A); A.addTemplateToGroup(I);
FJ: fullSet.add(F); F.addTemplateToGroup(J);
BE: fullSet.add(B); B.addTemplateToGroup(E);
AH: A.addTemplateToGroup(H);
AB: A.addTemplateToGroup(B); fullSet.remove(B); A.addGroupToGroup(B.group);
CF: C.addTemplateToGroup(F);

最后,您会得到以下相似组:

A - I, H, B, E
C - F, J
于 2011-08-29T07:53:53.763 回答