public FormTisda() { // // Required for Windows Form Designer support // InitializeComponent(); //Initialize managers video_manager = new VideoManager(); shotdetector = new ShotDetector(); xml_creator = new XMLCreator(); //Assign datasources listBoxShots.DataSource = video_manager.FilteredShotList; comboBoxDetectionMethod.DataSource = shotdetector.DetectionMethods; //Initialize stopwatch sw = new Stopwatch(); //Initialize selected_index = 0; comboBoxDetectionMethod.SelectedIndex = selected_index; panelParameters.Controls.Add((UserControl)shotdetector.Panels[selected_index]); }
static void test(String test_results_path, String filename, String truth_filename, int method_to_test) { //Creeer kortere filename voor bestandsnaam String short_filename = filename.Split('\\')[filename.Split('\\').Length - 1]; //Creeer lijst met testargumenten TextWriter tw = new StreamWriter(test_results_path + "\\test_results_" + short_filename + "_" + method_to_test + ".txt"); List <object[]> args_list = new List <object[]>(); switch (method_to_test) { case 1: args_list = testMethod1Args(); break; case 2: args_list = testMethod2Args(); break; case 3: args_list = testMethod3Args(); break; case 4: args_list = testMethod4Args(); break; case 5: args_list = testMethod5Args(); break; case 6: args_list = testMethod6Args(); break; default: break; } //Test uitvoeren voor alle mogelijke argumenten ShotDetector sd = new ShotDetector(); Stopwatch sw = new Stopwatch(); List <Shot> shotlist = new List <Shot>(); XMLCreator xmlcreator = new XMLCreator(); XMLComparator xmlcomp = new XMLComparator(); long timepassed; double[] results; double recall, precision; foreach (object[] args in args_list) { //Meten van het detecteren van de shots sw.Reset(); sw.Start(); shotlist = sd.detectShotsStandAlone(method_to_test - 1, filename, args); sw.Stop(); timepassed = sw.ElapsedMilliseconds; //Aanmaken van XML op basis van shotlist XmlDocument own = xmlcreator.createShotsXML(method_to_test, args, shotlist, filename); XmlDocument truth = new XmlDocument(); truth.Load(truth_filename); //Bereken recall en precision results = xmlcomp.performanceMeasures(truth, own); recall = results[0]; precision = results[1]; //Schrijf naar output String diag = ""; foreach (object arg in args) { diag += arg.ToString() + ";"; } diag += timepassed + ";" + recall + ';' + precision; tw.WriteLine(diag); Debug.WriteLine(diag); } tw.Close(); }
static void test(String test_results_path, String filename, String truth_filename, int method_to_test) { //Creeer kortere filename voor bestandsnaam String short_filename = filename.Split('\\')[filename.Split('\\').Length - 1]; //Creeer lijst met testargumenten TextWriter tw = new StreamWriter(test_results_path + "\\test_results_" + short_filename + "_" + method_to_test + ".txt"); List<object[]> args_list = new List<object[]>(); switch (method_to_test) { case 1: args_list = testMethod1Args(); break; case 2: args_list = testMethod2Args(); break; case 3: args_list = testMethod3Args(); break; case 4: args_list = testMethod4Args(); break; case 5: args_list = testMethod5Args(); break; case 6: args_list = testMethod6Args(); break; default: break; } //Test uitvoeren voor alle mogelijke argumenten ShotDetector sd = new ShotDetector(); Stopwatch sw = new Stopwatch(); List<Shot> shotlist = new List<Shot>(); XMLCreator xmlcreator = new XMLCreator(); XMLComparator xmlcomp = new XMLComparator(); long timepassed; double[] results; double recall, precision; foreach (object[] args in args_list) { //Meten van het detecteren van de shots sw.Reset(); sw.Start(); shotlist = sd.detectShotsStandAlone(method_to_test-1, filename, args); sw.Stop(); timepassed = sw.ElapsedMilliseconds; //Aanmaken van XML op basis van shotlist XmlDocument own = xmlcreator.createShotsXML(method_to_test, args, shotlist, filename); XmlDocument truth = new XmlDocument(); truth.Load(truth_filename); //Bereken recall en precision results = xmlcomp.performanceMeasures(truth, own); recall = results[0]; precision = results[1]; //Schrijf naar output String diag = ""; foreach (object arg in args) { diag += arg.ToString() + ";"; } diag += timepassed + ";" + recall + ';' + precision; tw.WriteLine(diag); Debug.WriteLine(diag); } tw.Close(); }