Esempio n. 1
0
 private static void DBTest()
 {
     DbHelper dbHelper = new DbHelper();
     int      a        = DbHelper.GetBestFingerprint(5);
     var      b        = DbHelper.GetTestingFingerprintSame(100, DbHelper.GetBestFingerprint(100));
     var      c        = dbHelper.GetTestingFingerprintDiff(100);
     //DbHelper.FindBestQualityFingerprint();
 }
Esempio n. 2
0
        private static void OneCycleTest()
        {
            int i = 5;
            int a = DbHelper.GetBestFingerprint(i);
            var b = DbHelper.GetTestingFingerprintSame(i, a);

            OneFullCycle(b[0].Item1, b[0].Item2, b[0].Item3, i.ToString() + "_" + a.ToString() + ".tif");
        }
Esempio n. 3
0
        public static long MultymodalAllSameTest(int step, double thresholdStep, double startThreshold, double endThreshold)
        {
            Stopwatch w        = Stopwatch.StartNew();
            string    strFirst = String.Format("Threshold NumFull NumYes NumNo NumIdk\n");

            File.AppendAllText(Constants.resultsPath + "MultymodalAllSameTest.txt", strFirst);

            Dictionary <int, List <Tuple <string, string, string> > > fpForMatchDictionary = new Dictionary <int, List <Tuple <string, string, string> > >();
            Dictionary <int, int> BestFp = new Dictionary <int, int>();

            for (int j = 1; j < 101; j += step)
            {
                int bestFp = DbHelper.GetBestFingerprint(j);
                BestFp.Add(j, bestFp);

                var newFpForMatch = DbHelper.GetTestingFingerprintSame(j, bestFp);
                fpForMatchDictionary.Add(j, newFpForMatch);
            }


            for (double threshold = startThreshold; threshold < endThreshold + 0.001; threshold += thresholdStep)
            {
                int numYes = 0;
                int numNo  = 0;
                int numAll = 0;
                for (int j = 1; j < 101; j += step)
                {
                    int bestFp     = BestFp[j];
                    var fpForMatch = fpForMatchDictionary[j];

                    string fileNameEt = j.ToString() + "_" + bestFp.ToString() + ".tif";

                    foreach (var item in fpForMatch)
                    {
                        var input = InputHelper.GetMultymodalInput(item.Item1, item.Item2, item.Item3, fileNameEt);
                        if (input[0] > threshold && input[1] > threshold && input[2] > threshold)
                        {
                            numYes++;
                        }
                        else
                        {
                            numNo++;
                        }
                        numAll++;
                    }
                }
                string str = String.Format("{0} {1} {2} {3} {4}\n", threshold, numAll, numYes, numNo, 0);
                File.AppendAllText(Constants.resultsPath + "MultymodalAllSameTest.txt", str);
            }
            w.Stop();
            return(w.ElapsedMilliseconds);
        }
Esempio n. 4
0
        public static long FuzzySameTest(int step, double thresholdStep, double startThreshold, double endThreshold)
        {
            Stopwatch w        = Stopwatch.StartNew();
            string    strFirst = String.Format("Threshold NumFull NumYes NumNo NumIdk\n");

            File.AppendAllText(Constants.resultsPath + "FuzzySameTest.txt", strFirst);

            DecisionMaker decisionMaker = new DecisionMaker();
            QualityHelper qhelper       = new QualityHelper();

            Dictionary <int, List <Tuple <string, string, string> > > fpForMatchDictionary = new Dictionary <int, List <Tuple <string, string, string> > >();
            Dictionary <int, int> BestFp = new Dictionary <int, int>();

            for (int j = 1; j < 101; j += step)
            {
                int bestFp = DbHelper.GetBestFingerprint(j);
                BestFp.Add(j, bestFp);

                var newFpForMatch = DbHelper.GetTestingFingerprintSame(j, bestFp);
                fpForMatchDictionary.Add(j, newFpForMatch);
            }


            for (double threshold = startThreshold; threshold < endThreshold + 0.001; threshold += thresholdStep)
            {
                int numYes = 0;
                int numNo  = 0;
                int numIdk = 0;
                int numAll = 0;
                for (int j = 1; j < 101; j += step)
                {
                    int bestFp = BestFp[j];

                    var fpForMatch = fpForMatchDictionary[j];

                    string fileNameEt = j.ToString() + "_" + bestFp.ToString() + ".tif";

                    foreach (var item in fpForMatch)
                    {
                        var input = InputHelper.GetMultyFuzzyInput(item.Item1, item.Item2, item.Item3, fileNameEt, qhelper);

                        var answer = decisionMaker.GetAnswer(input, threshold);
                        switch (answer.ValueName)
                        {
                        case "yes":
                            numYes++;
                            break;

                        case "no":
                            numNo++;
                            break;

                        case "idk":
                            numIdk++;
                            break;

                        default:
                            break;
                        }
                        numAll++;
                    }
                }
                string str = String.Format("{0} {1} {2} {3} {4}\n", threshold, numAll, numYes, numNo, numIdk);
                File.AppendAllText(Constants.resultsPath + "FuzzySameTest.txt", str);
            }
            w.Stop();
            return(w.ElapsedMilliseconds);
        }