如何在使用EMGU CV的人脸识别中获得置信度值? [英] How to get Confidence value in face recognition using EMGU CV?

查看:129
本文介绍了如何在使用EMGU CV的人脸识别中获得置信度值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在一个项目中,我应该设计一个应用程序,该应用程序可以检测路过的人的所有面孔...我有一个非常庞大的数据库,其中包含几个已知的人...我使用了EigenObjectRecognizer来识别网络摄像头捕获的图像帧...但是问题有时是它错误地识别了某些人....因此,如果获得此面部匹配的置信度值...那么我可以编写条件循环,以便大于75%,然后就不会检测到他.否则,我知道基于PCA的识别是基本的,我肯定会继续使用其他新算法.但是由于该项目的截止日期,我应该尽快提交. ..所以请告诉我如何获得此EigenObjectRecognizer面部识别的置信度值....

I am working on a project in which i should design an application which can detect all the faces of the persons passing by...I have a very large database comprising of several known people...I have used the EigenObjectRecognizer to recognize the image frame captured by the webcam...But the problem is sometimes it recognizes some persons wrongly....So if get the confidence value of this facial match...Then i can write a conditional loop so that if it is greater than 75%, then only detect him otherwise don't.Also I know that PCA based recognition is basic,I ll definitely move on to other new algorithms.But owing to the deadline of the project,I should submit it quickly....So please tell me how to get the confidence value of this EigenObjectRecognizer facial recognition....

推荐答案

虽然没有确切的置信度值,但是存在一个可以使用并大致解释为本征距离"的可变标度.

There is no exact confidence value however there is a variable scale that can be used and roughly interpreted as such which is the Eigen Distance.

被归类为良好匹配的值会根据您拥有的数据量和训练参数而变化,因此您必须测试不同面孔的值才能得出阈值.

The value that classifies as a good match changes according to the amount of data you have and the training parameters so you will have to test the values with different faces to work out your threshold.

您将必须向Eigen类添加一个函数以获得此值.首先,我们将覆盖我们使用的EigenObjectRecognizer.这确实很简单,位于文件EigenObjectRecognizer.cs中,它位于\ EMGU安装目录\ Emgu.CV中,或者您从中提取文件的任何位置都可以将其分层,因为它与bin文件夹位于同一文件夹中,所有您使用的.dll.

You will have to add a function to the Eigen class to obtain this value. First we will overwrite the EigenObjectRecognizer we use. This is really simple loacte the file EigenObjectRecognizer.cs, it is locates in the \EMGU Installation directory\Emgu.CV or where ever you extracted the files you should be able to lacate it as it's in the same folder as the bin folder with all the .dlls you use.

通过在Visual Studion的解决方案资源管理器中右键单击项目名称,然后选择添加">现有项目...",将文件添加到您的项目中.导航到文件并添加.您的项目将自动使用它,而不是您的引用中包含EMGU.CV.dll的项目.

Add the file to you project by right clicking on the project name in the solution explorer in visual studion and selecting Add>Existing Item... Navigate to the file and add it. Your project will automatically use this rather than the one held with EMGU.CV.dll in your references.

现在在您的项目中打开EigenObjectRecognizer.cs,不用担心它是原始版本的副本,因此您所做的任何更改都不会影响原始源代码.首先,按住Ctrl键的同时先按m键,再按o键,可以简化所有方法字段.

Open the EigenObjectRecognizer.cs now in your project, don't worry it's a copy of the original so any change you make won't effect the original source. To start of with make things easier by holding the Ctrl the pressing the m key followed by the o key this will collapse all method fields.

首先,我们需要覆盖我称为mine Emgu.Custom的名称空间.

To start of with we need to overwrite the namespace I called mine Emgu.Custom.

现在在代码顶部,在其他代码下方添加以下变量

Now at the top of the code add the following variable underneath the others

private float eigenDistance;

将以下方法添加到类中,

Add the following method to class,

  /// <summary>
  /// Get the calculated Eignen Distance for the last proceessed frame
  /// </summary>
  public float GetEignenDistance
  {
      get { return eigenDistance; }
  }

您可以将其放置在任何地方,但显然可以在类内和方法外(现在很重要).我们已经将eigenDistance设为全局,但它是在我们调用.Recognize(Image image)方法时私下创建的.

You can place this anywhere you but obviously within the class and outside a method, now the important bit. We have made eigenDistance global but it's privately created when we call the .Recognize(Image image) method.

在EigenObjectRecognizer.cs中找到此方法并进行更改

Find this method within EigenObjectRecognizer.cs and change

float eigenDistance;

eigenDistance = -1;

您可以删除float eigenDistance;行,但我想确保它被一个我可以观察到的错误值覆盖,因为如果正确应用了识别,它应该始终为正.您会注意到以下代码部分包括:

you could delete the float eigenDistance; line but I like to ensure it's overwritten with a value that I can observe for an error as it should always be positive if recognition has been applied correctly. You will notice that the following section of code includes:

FindMostSimilarObject(image, out index, out eigenDistance, out label);

  • 索引
  • eigenDistance
  • 标签
  • 是否所有输出都可以通过一些额外的编码使用.

    Are all outputs available for use with a little extra coding.

    我们无需将本征识别器变量指向写一个:

    We no need to point our Eigen recognizer variable to the write one:

    Emgu.Custom.EigenObjectRecognizer recognizer;
    

    我们现在可以通过以下函数调用获取EigenDistance:

    We can now obtain the EigenDistance with this function call:

    float EigenDistance = recognizer.GetEignenDistance;
    

    希望这可以清除一切,

    干杯

    克里斯

    这篇关于如何在使用EMGU CV的人脸识别中获得置信度值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆