private void Learn() { int[,] clipArr = NeiroGraphUtils.CutImageToArray((Bitmap)pictureBox1.Image, new Point(pictureBox1.Width, pictureBox1.Height)); if (clipArr == null) { return; } arr = NeiroGraphUtils.LeadArray(clipArr, new int[NeiroWeb.neironInArrayWidth, NeiroWeb.neironInArrayHeight]); pictureBox2.Image = NeiroGraphUtils.GetBitmapFromArr(clipArr); pictureBox3.Image = NeiroGraphUtils.GetBitmapFromArr(arr); string s = nw.CheckLitera(arr); if (s == null) { s = "null"; } DialogResult askResult = MessageBox.Show("result = " + s + " ?", "", MessageBoxButtons.YesNo); if (askResult != DialogResult.Yes || !enableTraining || MessageBox.Show("save ?", "", MessageBoxButtons.YesNo) != DialogResult.Yes) { return; } nw.SetTraining(s, arr); NeiroGraphUtils.ClearImage(pictureBox1); NeiroGraphUtils.ClearImage(pictureBox2); NeiroGraphUtils.ClearImage(pictureBox3); }
private void Learn() { int[,] clipArr = NeiroGraphUtils.CutImageToArray((Bitmap)pictureBox1.Image, new Point(pictureBox1.Width, pictureBox1.Height)); if (clipArr == null) { return; } arr = NeiroGraphUtils.LeadArray(clipArr, new int[NeiroWeb.neironInArrayWidth, NeiroWeb.neironInArrayHeight]); pictureBox2.Image = NeiroGraphUtils.GetBitmapFromArr(clipArr); pictureBox3.Image = NeiroGraphUtils.GetBitmapFromArr(arr); string s = nw.CheckLitera(arr); if (s == null) { s = "null"; } label4.Text = s; DialogResult askResult = MessageBox.Show("Результат распознавания - " + s + " ?", "", MessageBoxButtons.YesNo); if (askResult != DialogResult.Yes || !enableTraining || MessageBox.Show("Добавить этот образ в память нейрона '" + s + "'", "", MessageBoxButtons.YesNo) != DialogResult.Yes) { return; } nw.SetTraining(s, arr); // очищаем рисунки NeiroGraphUtils.ClearImage(pictureBox1); NeiroGraphUtils.ClearImage(pictureBox2); NeiroGraphUtils.ClearImage(pictureBox3); }
private void LoadTestImagesToolStripMenuItem_Click(object sender, EventArgs e) { temp_images_mas = LoadData(testpixelFile, testlabelFile); double count = 0; foreach (DigitImage item in temp_images_mas) { int[,] arr = NeiroGraphUtils.LeadArray(item.pixels, new int[NeiroWeb.neironInArrayWidth, NeiroWeb.neironInArrayHeight]); if (nw.CheckLitera(arr) == Convert.ToString(item.label)) { count++; } } MessageBox.Show("Коэффициент распознавания тестовой выборки (" + temp_images_mas.Count() + ") = " + 100 * count / temp_images_mas.Count() + "%"); }
private void Act() { int[,] clipArr = NeiroGraphUtils.CutImageToArray((Bitmap)pictureBox1.Image, new Point(pictureBox1.Width, pictureBox1.Height)); if (clipArr == null) { return; } arr = NeiroGraphUtils.LeadArray(clipArr, new int[NeiroWeb.neironInArrayWidth, NeiroWeb.neironInArrayHeight]); pictureBox2.Image = NeiroGraphUtils.GetBitmapFromArr(clipArr); pictureBox3.Image = NeiroGraphUtils.GetBitmapFromArr(arr); string s = nw.CheckLitera(arr); if (s == null) { s = "null"; } DialogResult askResult; if (режимПереобученияToolStripMenuItem.Checked) { askResult = MessageBox.Show("Результат = " + s + " ?", "", MessageBoxButtons.YesNo); } else { askResult = MessageBox.Show("Результат = " + s); } if (askResult == DialogResult.Yes || !режимПереобученияToolStripMenuItem.Checked) { return; } DialogResult askLearn = MessageBox.Show("Переобучить нейросеть на этом примере?", "", MessageBoxButtons.YesNo); if (askLearn == DialogResult.No) { return; } string s2 = Microsoft.VisualBasic.Interaction.InputBox("Введите верное значение"); nw.SetTraining(s2, arr); StatusUpdate(); Clear(); }
private void Write() { int[,] clipArr = NeiroGraphUtils.CutImageToArray((Bitmap)pictureBox1.Image, new Point(pictureBox1.Width, pictureBox1.Height)); if (clipArr == null) { return; } arr = NeiroGraphUtils.LeadArray(clipArr, new int[NeiroWeb.neironInArrayWidth, NeiroWeb.neironInArrayHeight]); pictureBox2.Image = NeiroGraphUtils.GetBitmapFromArr(clipArr); pictureBox3.Image = NeiroGraphUtils.GetBitmapFromArr(arr); string s = nw.CheckLitera(arr); if (s == null) { s = "null"; } textBox2.Text += s; NeiroGraphUtils.ClearImage(pictureBox1); NeiroGraphUtils.ClearImage(pictureBox2); NeiroGraphUtils.ClearImage(pictureBox3); nw.SetTraining(s, arr); label4.Text = s; }