示例#1
0
        private void TrainStatsButton_Click(object sender, RoutedEventArgs e)   //show the evaluation window upon button click
        {
            Process process = Process.Start("explorer.exe", CurrentProject.ConfigPath.Substring(0, CurrentProject.ConfigPath.LastIndexOf("\\")) + "\\evaluation-results");

            GetAllEvalResults(ref CurrentProject);
            EvalWindow evalWindow = new EvalWindow(CurrentProject.TrainTime, CurrentProject.TrainError, CurrentProject.TestError, CurrentProject.PCutoff);

            evalWindow.Show();
        }
示例#2
0
 private void button1_Click(object sender, EventArgs e)
 {
     EvalWindow.Show();
     EvalWindow.Focus();
 }
示例#3
0
        //MARK: Evaluation Methods
        private void EvalNetwork(string elapsedTime)   //evaluate the newly trained network using DeepLabCut's evaluate_network function
        {
            BarInteraction();
            string filePath = EnvDirectory + "\\vdlc_eval_network.py";

            FileSystemUtils.MurderPython();
            FileSystemUtils.RenewScript(filePath, AllScripts.EvalNetwork);
            FileSystemUtils.ReplaceStringInFile(filePath, "config_path_identifier", CurrentProject.ConfigPath);
            Process          p    = new Process();
            ProcessStartInfo info = new ProcessStartInfo();

            info.FileName = "cmd.exe";
            info.RedirectStandardInput = true;
            info.UseShellExecute       = false;
            info.Verb           = "runas";
            info.CreateNoWindow = !ReadShowDebugConsole(); //if show debug console = true, then create no window has to be false

            this.Dispatcher.Invoke(() => {
                LoadingWindow       = new LoadingWindow();
                LoadingWindow.Title = "Evaluating";
                LoadingWindow.Show();
                LoadingWindow.Closed += LoadingClosed;
                LoadingWindow.ProgressBar.Maximum   = 100;
                LoadingWindow.ProgressBar.Value     = 100;
                LoadingWindow.ProgressLabel.Content = "Just a sec...";
            });

            p.EnableRaisingEvents = true;
            p.Exited += (sender1, e1) => {
                CurrentProject.TrainTime = elapsedTime;
                GetEvalResultsSaveTime(ref CurrentProject);
                this.Dispatcher.Invoke(() => {
                    LoadingWindow.Close();
                    EvalWindow evalWindow = new EvalWindow(CurrentProject.TrainTime, CurrentProject.TrainError, CurrentProject.TestError, CurrentProject.PCutoff); //once done evaluating, show a window with evaluation stats
                    evalWindow.Show();
                });
                SyncUI();
                EnableInteraction();
            };

            p.StartInfo = info;
            p.Start();
            globalStopWatch = new Stopwatch();
            globalStopWatch.Start();

            using (
                StreamWriter sw = p.StandardInput) { //run the evaluation script
                if (sw.BaseStream.CanWrite)
                {
                    sw.WriteLine(Drive);
                    sw.WriteLine("cd " + EnvDirectory);
                    sw.WriteLine(FileSystemUtils.CONDA_ACTIVATE_PATH);
                    sw.WriteLine("conda activate " + EnvName);
                    sw.WriteLine("ipython vdlc_eval_network.py");

                    if (info.CreateNoWindow == false)   //for debug purposes
                    {
                        sw.WriteLine("ECHO WHEN YOU'RE DONE, CLOSE THIS WINDOW");
                        p.WaitForExit();
                        sw.WriteLine("Done, exiting.");
                    }
                }
            }
        }