Esempio n. 1
0
        public void fillHistogram(ref int[] histogram, bool genuine)
        {
            int    binCount    = histogram.Count();
            double maxDistance = this.getStatistics().GlobalExtremes.max;

            foreach (BIO.Framework.Core.Evaluation.Results.Result value in this.getResults().getResultsList())
            {
                bool isGeniune = value.isGenuine();
                if ((genuine && isGeniune) || (!genuine && !isGeniune))
                {
                    MatchingScore ms = value.getMatchingScore(this.getMethod());

                    if (!ms.IsValid)
                    {
                        continue;
                    }

                    int bin = getBin(ms.Score, maxDistance);
                    if (bin < 0 || bin >= histogram.Count())
                    {
                        continue;
                    }
                    histogram[bin]++;
                }
            }
        }
Esempio n. 2
0
        private void fillDistances(List <BIO.Framework.Core.Evaluation.Results.Result> results, ref PointPairList data, bool genuine)
        {
            data.Clear();
            //int templateNumber = 0;
            foreach (BIO.Framework.Core.Evaluation.Results.Result r in results)
            {
                bool isGenuine = r.isGenuine();
                if ((genuine && isGenuine) || (!genuine && !isGenuine))
                {
                    MatchingScore ms = r.getMatchingScore(this.getMethod());

                    //distances.Add(value.Value.getValue(evaluator));
                    if (!ms.IsValid)
                    {
                        continue;
                    }
                    int    tn  = 0;
                    string key = r.TemplateRecord.BiometricID.PersonID;
                    if (templateNumbers.ContainsKey(key))
                    {
                        tn = templateNumbers[key];
                    }
                    else
                    {
                        templateNumbers.Add(key, this.maxTemplateNumber++);
                        tn = templateNumbers[key];
                    }

                    PointPair p = new PointPair(tn, ms.Score);
                    p.Tag = r;
                    data.Add(p);
                }
            }
        }
Esempio n. 3
0
 public MatchingScore getMatchingScore(string method)
 {
     if (!matchingScores.ContainsKey(method))
     {
         return(MatchingScore.invalid());
     }
     return(matchingScores[method]);
 }
Esempio n. 4
0
 public void setMatchingScore(string method, MatchingScore score)
 {
     if (!matchingScores.ContainsKey(method))
     {
         matchingScores.Add(method, score);
     }
     else
     {
         matchingScores[method] = score;
     }
 }
Esempio n. 5
0
        public virtual MatchingScore computeMatchingScore(int templateIndex)
        {
            MatchingScore matchingScoreToBeResolved = MatchingScore.invalid();

            foreach (Core.Block.IInputDataProcessingBlock <TInputData> block in iterator())
            {
                MatchingScore ms = block.computeMatchingScore(templateNumbers[templateIndex][block.Name]);
                matchingScoreToBeResolved.addSubscore(block.Name, ms);
            }

            return(this.getScoreFusionBlock().resolve(matchingScoreToBeResolved));
        }
Esempio n. 6
0
 /// <summary>
 /// verification
 /// TODO -> speed up by caching
 /// TODO -> progress reporting
 /// </summary>
 /// <param name="inputData"></param>
 /// <param name="biometricID"></param>
 /// <returns></returns>
 public Core.BiometricSystem.IVerificationResult verify(TInputData inputData, Core.Database.BiometricID biometricID)
 {
     this.settings.getProcessingBlock().setInputData(inputData);
     foreach (var record in this.getTemplateDatabase().getCollections().getRecordsByBiometricID(biometricID))
     {
         this.settings.getProcessingBlock().resetTemplates();
         int                  index  = this.settings.getProcessingBlock().pushTemplate(record.PersistentTemplate);
         MatchingScore        s      = this.settings.getProcessingBlock().computeMatchingScore(index);
         IDecisionMakerResult result = this.settings.getDecisionMaker().makeDecision(s);
         if (result.Status == ResultStatus.ACCEPTED)
         {
             return(new VerificationResult(result, record.BiometricID));
         }
     }
     return(new VerificationResult(ResultStatus.REJECTED));
 }
Esempio n. 7
0
 public void setMatchingScore(string method, MatchingScore score)
 {
     if (!matchingScores.ContainsKey(method)) {
         matchingScores.Add(method, score);
     } else {
         matchingScores[method] = score;
     }
 }
Esempio n. 8
0
        private void innerUpdate(List <Result> resultsList)
        {
            this.clear(true);
            foreach (Result r in resultsList)
            {
                //if (results.ActiveFiltering != null && !results.ActiveFiltering.pass(r)) {
                //    continue;
                //}
                MatchingScore cmpValue = r.getMatchingScore(method);

                if (!cmpValue.IsValid)
                {
                    continue;
                }
                bool isGeniune = r.isGenuine();

                //Console.Write(isGeniune ? "G" : "I");
                //Console.Write(cmpValue.ToString());

                if (isGeniune)
                {
                    this.GenuinesCount++;
                }
                else
                {
                    this.ImpostorsCount++;
                }
                this.TotalResultsCount++;

                this.GlobalExtremes.update(cmpValue.Score);

                if (isGeniune)
                {
                    this.GenuineExtremes.update(cmpValue.Score);
                    if (this.UnderThreshAccepted)
                    {
                        if (cmpValue.Score < this.Thresh)
                        {
                            this.TrueAcceptance++;
                        }
                        else
                        {
                            this.FalseRejection++;
                        }
                    }
                    else
                    {
                        if (cmpValue.Score > this.Thresh)
                        {
                            this.TrueAcceptance++;
                        }
                        else
                        {
                            this.FalseRejection++;
                        }
                    }
                }
                else
                {
                    this.ImpostorExtremes.update(cmpValue.Score);
                    if (this.UnderThreshAccepted)
                    {
                        if (cmpValue.Score < this.Thresh)
                        {
                            this.FalseAcceptance++;
                        }
                        else
                        {
                            this.TrueRejection++;
                        }
                    }
                    else
                    {
                        if (cmpValue.Score > this.Thresh)
                        {
                            this.FalseAcceptance++;
                        }
                        else
                        {
                            this.TrueRejection++;
                        }
                    }
                }
            }

            if (this.underThreshAccepted)
            {
                this.overlapArea.max = this.GenuineExtremes.max;
                this.overlapArea.min = this.ImpostorExtremes.min;
            }
            else
            {
                this.overlapArea.max = this.ImpostorExtremes.max;
                this.overlapArea.min = this.GenuineExtremes.min;
            }
        }
Esempio n. 9
0
        public void evaluateRecords(Core.Database.IRecordEnumerable <TInputRecord> inputDatabase, TemplateDatabase templateDatabase, Core.Evaluation.Results.Results results)
        {
            onProgressChanged(new ProgressReport("Records evaluation started"));

            Dictionary <string, Dictionary <int, Core.Database.TemplateDatabase.TemplateRecord> > cache = new Dictionary <string, Dictionary <int, Core.Database.TemplateDatabase.TemplateRecord> >();

            //onProgressChanged(new ProgressReport("Create cache"));
            //List<TemplateCacheRecord> cache = new List<TemplateCacheRecord>();

            foreach (var block in evaluationSettings.getEvaluatedBlockIterator())
            {
                block.resetTemplates();
                cache.Add(block.Name, new Dictionary <int, Core.Database.TemplateDatabase.TemplateRecord>());
                foreach (Core.Database.TemplateDatabase.TemplateRecord templateRecord in templateDatabase.getCollections().getRecords())
                {
                    cache[block.Name].Add(
                        block.pushTemplate(
                            templateRecord.PersistentTemplate.getSubtemplate(block.Name)),
                        templateRecord
                        );
                }
            }

            int total = inputDatabase.getRecords().Count() * evaluationSettings.getEvaluatedBlockIterator().Count();
            int act   = 0;

            foreach (TInputRecord r in inputDatabase.getRecords())
            {
                string message = "Records evaluation ";
                message += ".";
                onProgressChanged(new ProgressReport(message, act, total));

                //create input data
                TInputData inputData = this.evaluationSettings.getInputDataCreator().createInputData(r);

                message += ".";
                onProgressChanged(new ProgressReport(message, act, total));

                foreach (var block in evaluationSettings.getEvaluatedBlockIterator())
                {
                    act++;

                    block.setInputData(inputData);

                    foreach (KeyValuePair <int, Core.Database.TemplateDatabase.TemplateRecord> pair in cache[block.Name])
                    {
                        //compare
                        MatchingScore matchingScore = block.computeMatchingScore(pair.Key);

                        //store result
                        Result result = new Result(new Record(pair.Value), new Record(r));
                        result.setMatchingScore(block.Name, matchingScore);

                        results.addResult(result);
                    }

                    message += ".";
                    onProgressChanged(new ProgressReport(message, act, total));
                }
            }
        }