private void btn_generate_graph_Click(object sender, EventArgs e) { // first, get dataset path string data_set_path = get_current_data_set(); if (data_set_path == null) { Helper.error_message("Path to dataset not found"); return; } // flush current graph data (as exporter requires path to be empty) DialogResult result = MessageBox.Show("The following action requires the current graph data of the data set to be flushed. " + "Make sure you have a backup of these data if you still need them for later use.\n" + "Are you sure you want to proceed?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (result == DialogResult.No) { return; } // proceed to flush old data LoadingProgressView loading_view = new LoadingProgressView("Flushing old graph data"); Action failure = () => { loading_view.Close(); }; loading_view.Show(); (int del_code, string del_output) = _data_set_controller.clear_graph_data(data_set_path, failure); if (del_output != null) { Helper.error_message("Error flushing graph data: " + del_output); return; } // generate graph using data set path Action <string> update = (progress) => { loading_view.set_progress(progress); }; (int code, string output) = _data_set_controller.generate_graph(data_set_path, update); loading_view.Close(); if (code == 0) { Helper.dialog_message("Inference graph successfully generated"); string data_set_dir = get_current_data_set(); if (data_set_dir == null) { return; } bind(cbox_graph, _data_set_controller.get_inference_graphs(data_set_dir)); } else { Helper.error_message("Error generating inference graph, exit code: " + code); } }
private void btn_generate_training_resources_Click(object sender, EventArgs e) { string data_set_dir = get_current_data_set(); if (data_set_dir == null) { return; } LoadingProgressView loading_view = new LoadingProgressView(); loading_view.Show(); int exit_code = _data_set_controller.generate_csv_tfrecords(data_set_dir, (status) => { loading_view.set_progress(status); }); loading_view.Close(); if (exit_code == 0) { MessageBox.Show("Training resources successfully generated", "Success", MessageBoxButtons.OK); } else { MessageBox.Show("Unexpected error while generating Resources for training. Exit code: " + exit_code, "Failure", MessageBoxButtons.OK); } }
private void btn_import_graph_Click(object sender, EventArgs e) { string data_set_path = get_current_data_set(); if (data_set_path == null) { return; } var result = MessageBox.Show("An inference graph from unidentified outer sources may cause unexpected error or undesirable detection results. Proceed if you are sure the graph was generated using reliable data and configurations", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (result != DialogResult.Yes) { return; } OpenFileDialog dialog = new OpenFileDialog(); dialog.Filter = "PB text files|*.pb"; if (dialog.ShowDialog() != DialogResult.OK) { return; } // TODO: currently allows overwriting, implement formal process if time allows string graph_name = Path.GetFileName(dialog.FileName); string message = "Importing <" + graph_name + "> to " + new DirectoryInfo(data_set_path).Name.ToUpper(); LoadingProgressView loading_view = new LoadingProgressView(message); loading_view.Show(); _data_set_controller.import_graph(Path.Combine(data_set_path, "graph"), dialog.FileName); loading_view.Close(); bind(cbox_graph, _data_set_controller.get_inference_graphs(data_set_path)); }