C# 数字角色验证过程需要大量的时间和庞大的数据库

C# 数字角色验证过程需要大量的时间和庞大的数据库,c#,fingerprint,C#,Fingerprint,我正在开发一个软件,它使用的是数字人物U.are.U 4000b指纹读取器 工作正常。但我在指纹验证过程中遇到了性能问题 我的数据库大约有3000个指纹在那里注册,我需要在验证过程中循环所有指纹 但是每次成功的指纹读取都需要大约7秒钟的时间来匹配我数据库的相应记录(这取决于它的索引) 这对我来说是不可接受的,因为我需要在20分钟的时间间隔内至少注册400名学生(并实时显示他们的数据、照片)。 问题在于庞大的指纹数据库,因为当我用一个较小的数据库测试它时,它工作得很好 我正在使用带C#的.NET和

我正在开发一个软件,它使用的是数字人物U.are.U 4000b指纹读取器

工作正常。但我在指纹验证过程中遇到了性能问题

我的数据库大约有3000个指纹在那里注册,我需要在验证过程中循环所有指纹

但是每次成功的指纹读取都需要大约7秒钟的时间来匹配我数据库的相应记录(这取决于它的索引)

这对我来说是不可接受的,因为我需要在20分钟的时间间隔内至少注册400名学生(并实时显示他们的数据、照片)。 问题在于庞大的指纹数据库,因为当我用一个较小的数据库测试它时,它工作得很好

我正在使用带C#的.NET和一个免费的指纹SDK。 导致此问题的代码行是在FOREACH中执行的代码行(针对数据库的每个注册指纹):


  • verificator
    是处理验证过程的
    DPFP.Verification.Verification
    对象
  • features
    是包含实际指纹数据的
    DPFP.FeatureSet
    对象
  • template
    是表示每个注册指纹的
    DPFP.template
    对象
  • result
    是一个
    DPFP.Verification.Verification.result
    对象,其中包含每个指纹验证的返回
以下是整个
过程
方法:

    protected void process(DPFP.Sample sample)
    {
        DPFP.FeatureSet features = ExtractFeatures(sample, DPFP.Processing.DataPurpose.Verification);
        bool verified = false;
        if (features != null)
        {
            DPFP.Verification.Verification.Result result = new DPFP.Verification.Verification.Result();
            //"allTemplates" is an List<> of objects that contains all the templates previously loaded from DB
            //There is no DB access in these lines of code
            foreach (var at in allTemplates)
            {
                verificator.Verify(features, at.template, ref result);
                if (result.Verified)
                {
                    register(at.idStudent);
                    verified = true;
                    break;
                }
            }
        }
        if (!verified)
            error("Invalid student.");
    }
protectedvoid进程(DPFP.Sample)
{
DPFP.FeatureSet features=ExtractFeatures(示例,DPFP.Processing.DataPurpose.Verification);
bool-verified=false;
如果(功能!=null)
{
DPFP.Verification.Verification.Result结果=新的DPFP.Verification.Verification.Result();
//“allTemplates”是一个对象列表,其中包含以前从DB加载的所有模板
//这些代码行中没有DB访问权限
foreach(所有模板中的变量)
{
验证器。验证(特征、at.模板、参考结果);
如果(结果已验证)
{
注册(在.idStudent);
验证=真实;
打破
}
}
}
如果(!已验证)
错误(“无效学生”);
}
我做得对吗


还有另一种方法可以完成这项工作吗?

试试SourceAFIS。它是开源的,如果你将指纹缓存在内存中,它会以每秒10k指纹的速度执行你所说的1-N识别过程。源代码也是100%C#。

最好将模板转换为字符串

byte [] a = new byte [1632];
Template.Serialize (ref a);
string Convert.ToBase64String basestring = (a);
然后返回到模板的正常状态

byte [] b = new byte [1632];
b = Convert.FromBase64String (trace) / / pass the base-64 string to a byte array.
/ / create a Template type varibale where we store the template
DPFP.Template DPFP.Template template = new ();
/ / what to compare it desserializamos
template.DeSerialize (b);

我通过购买(我“赢得”了它,因为我已经买了一个阅读器)SDK的新版本来解决我的问题,该版本已经实现了识别(1:n)功能。
您可以在获得更多信息并下载(购买)SDK。

我将分析数据库,看看您是否可以确定是什么查询导致了速度缓慢。一旦确定,您就可以开始考虑如何潜在地提高性能。问题肯定与数据库无关。我执行注册指纹的预加载。显示的行是速度慢的原因。您如何知道显示的行没有击中DB?如果它没有击中DB,并且您没有访问验证函数的源代码,我认为您不能做太多
verificator
是一个
DPFP.Verification.Verification
。这是一个SDK的类。
byte [] b = new byte [1632];
b = Convert.FromBase64String (trace) / / pass the base-64 string to a byte array.
/ / create a Template type varibale where we store the template
DPFP.Template DPFP.Template template = new ();
/ / what to compare it desserializamos
template.DeSerialize (b);