Example #1
0
        //Retest
        //No Header
        public static List <String> buildMatrixA_file(List <Instance> list_inst, List <m_Motion> list_motion)
        {
            List <String> matrix = new List <String>();

            foreach (Instance inst in list_inst)
            {
                string matrix_data = inst.name + "," + inst.subject_id + "," + inst.motion_id;
                foreach (m_Motion motion in list_motion)
                {
                    Boolean detected = false;
                    detected     = TheRuleTester.testDetectMotion(inst.getDataRaw(true), motion.inputs);
                    matrix_data += "," + TheTool.convertBoolean_01(detected);
                }
                matrix.Add(matrix_data);
            }
            return(matrix);//TheTool.convert_List_toDataTable(matrix)
        }
Example #2
0
        public int computeDetectionRate(List <m_If> rules, List <Instance> data_list)
        {
            int score = 0;

            if (data_list.Count > 0)
            {
                int inst_count = 0;
                foreach (Instance d in data_list)
                {
                    if (TheRuleTester.testDetectMotion(d.getDataRaw(true), rules))
                    {
                        score++;
                    }
                    inst_count++;
                }
                score *= 100;
                score /= inst_count;
            }
            return(score);
        }
Example #3
0
        void motionModel_evaluationEach(string header, m_Motion motion)
        {
            summary_total.Add("");
            List <string> motionFailed = new List <string>();

            int           detectected_count = 0;
            int           all_inst          = container.list_inst.Count();
            List <string> all_log           = new List <string>();

            foreach (Instance inst in container.list_inst)
            {
                Boolean      detected = TheRuleTester.testDetectMotion(inst.getDataRaw(true), motion.inputs);
                logDetection log      = TheRuleTester.temp_log;
                string       s        = "";
                if (detected)
                {
                    s += "[O] ";
                    detectected_count++;
                }
                else
                {
                    s += "[X] ";
                    motionFailed.Add(inst.name + " is unrecognized with " + header);
                }
                s += inst.name + " [" + log.info + "]";
                all_log.Add(s);
            }
            double acc = (double)detectected_count * 100 / all_inst;

            acc = Math.Round(acc, 2);
            //---------
            summary_total.Add(header += " : " + acc + "% (" + detectected_count + "/" + all_inst + ")");
            foreach (string s in all_log)
            {
                summary_total.Add(s);
            }
            if (acc < 100)
            {
                TheTool.exportFile(motionFailed, TheTool.filePath + "all_incomplete_motion.txt", false, true);
            }
        }
Example #4
0
        //Motion Analysis on 1 File
        //All Data (Whole Sequence) - All Motion
        //Output: Matrix
        static public string motionAnalysis(String path_load, String path_save, List <m_Motion> list_motions)
        {
            string              currentFileName = TheTool.getFileName_byPath(path_load);
            string              matrix_data     = currentFileName;
            List <UKI_DataRaw>  list_raw        = TheUKI.csv_loadFileTo_DataRaw(path_load, 0);
            List <logDetection> log_list        = new List <logDetection>();//keep output summary
            //--- Preprocess to obtain BasePosture Data
            UKI_Offline mr = new UKI_Offline();

            mr.UKI_OfflineProcessing(list_raw, 0);
            List <UKI_Data_AnalysisForm> data = TheUKI.getData_AnalysisForm(mr.data.data_raw, mr.data.data_bp);

            //--- Analysis Motion by Motion
            foreach (m_Motion motion in list_motions)
            {
                Boolean      detected = TheRuleTester.testDetectMotion(data, motion.inputs);
                logDetection log      = TheRuleTester.temp_log;
                //
                log.info = motion.name + " ( " + log.info + " )";
                if (detected)
                {
                    log.info = "[" + log.detectAt + "] " + log.info;
                }
                else
                {
                    log.info = "[X] " + log.info;
                }
                log_list.Add(log);
                matrix_data += "," + TheTool.convertBoolean_01(detected);
            }
            //--------------------------------
            TheSys.showError("File: " + currentFileName);
            foreach (logDetection s in log_list.OrderBy(o => o.detectAt).ThenBy(o => o.num_pose))
            {
                TheSys.showError(s.info);
            }
            TheSys.showError("---------------------");
            return(matrix_data);
        }