private void Train_bt_Click(object sender, EventArgs e) { // intialize.readTrainingData(); //richTextBox1.Text = "training data been readed"; //setup stopwatch and begin timing if (back_propagation_chk.Checked) { var timer = System.Diagnostics.Stopwatch.StartNew(); Back_Propagation BP = new Back_Propagation(double.Parse(mse_threshold.Text), double.Parse(Learning_rate.Text), true); BP.StartLearning(ref Layers); BP.StartTesting(ref Layers, ref _MSE, ref Mis_Matchesl, ref accuracy_label); timer.Stop(); var elapsed = timer.Elapsed; MessageBox.Show("training time" + elapsed.ToString("mm':'ss':'fff")); } if (RBF_ch.Checked) { int count = Layers[0].Count; RPF rpf = new RPF(count, int.Parse(epochs_num.Text), double.Parse(Learning_rate.Text), double.Parse(mse_threshold.Text)); var timer1 = System.Diagnostics.Stopwatch.StartNew(); rpf.Training(ref Layers); //int[,] mat = rpf.Testing(); //int tmp = mat[0, 0]; //MessageBox.Show(" " + tmp + " "); timer1.Stop(); var elapsed1 = timer1.Elapsed; MessageBox.Show("training time" + elapsed1.ToString("mm':'ss':'fff")); } }
private void S_test_Click(object sender, EventArgs e) { Back_Propagation BP = new Back_Propagation(double.Parse(mse_threshold.Text), double.Parse(Learning_rate.Text), true); BP.SingleTest(ref Layers, ref singleTest_Label); if (singleTest_Label.Text == "closing eyes") { Bitmap B = PGMUtil.ToBitmap("Dataset\\Testing Dataset\\Closing Eyes\\BioID_0069.pgm"); //this.Size = B.Size; pictureBox2.Image = (Image)B; int s = fn.LastIndexOf('\\') + 1; this.Text = fn.Substring(s) + " (W: " + B.Width.ToString() + ", H: " + B.Height.ToString() + ")"; } if (singleTest_Label.Text == "looks down") { Bitmap B = PGMUtil.ToBitmap("Dataset\\Testing Dataset\\Closing Eyes\\BioID_0113.pgm"); //this.Size = B.Size; pictureBox2.Image = (Image)B; int s = fn.LastIndexOf('\\') + 1; this.Text = fn.Substring(s) + " (W: " + B.Width.ToString() + ", H: " + B.Height.ToString() + ")"; } if (singleTest_Label.Text == "looks front") { Bitmap B = PGMUtil.ToBitmap("Dataset\\Testing Dataset\\Looking Front\\BioID_0379.pgm"); //this.Size = B.Size; pictureBox2.Image = (Image)B; int s = fn.LastIndexOf('\\') + 1; this.Text = fn.Substring(s) + " (W: " + B.Width.ToString() + ", H: " + B.Height.ToString() + ")"; } if (singleTest_Label.Text == "looks left") { Bitmap B = PGMUtil.ToBitmap("Dataset\\Testing Dataset\\Looking Left\\BioID_0107.pgm"); //this.Size = B.Size; pictureBox2.Image = (Image)B; int s = fn.LastIndexOf('\\') + 1; this.Text = fn.Substring(s) + " (W: " + B.Width.ToString() + ", H: " + B.Height.ToString() + ")"; } }