public void CreateNW(int SizeX, int[] Layers) { NET = new NeuralNW(SizeX, Layers); path = ""; txtLogs.AppendText("Создана полносвязная сеть:\r\n"); txtLogs.AppendText("Число входов: " + Convert.ToString(SizeX) + "\r\n"); txtLogs.AppendText("Число выходов: " + Convert.ToString(Layers[Layers.Count() - 1]) + "\r\n"); txtLogs.AppendText("Число скрытых слоёв: " + Convert.ToString(Layers.Count() - 1) + "\r\n"); for (int i = 0; i < Layers.Count() - 1; i++) { txtLogs.AppendText("Нейронов в " + Convert.ToString(i + 1) + " скрытом слое: " + Convert.ToString(Layers[i]) + "\r\n"); } }
public NeuroHelper() { Load(); if (File.Exists(BrainFile)) { NET = new NeuralNW(BrainFile); } else { //int[] layers = new int[5]; //layers[0] = (31 * 31) / 4; //layers[1] = (31*31)/2; //layers[2] = 31*31; //layers[3] = 31 * 5; //layers[4] = 31; //CreateNW(96, layers); //NET.SaveNW(BrainFile); } }
public void CreateNW(int SizeX, int[] Layers) { NET = new NeuralNW(SizeX, Layers); path = ""; }
private void открытьToolStripMenuItem_Click(object sender, EventArgs e) { openFileDialog1.ShowDialog(); path = openFileDialog1.FileName; if (File.Exists(path)) { try { NET = new NeuralNW(path); } finally { } txtLogs.AppendText("Загружена сеть:\r\n" + path + "\r\n"); txtLogs.AppendText("Число входов: " + Convert.ToString(NET.GetX) + "\r\n"); txtLogs.AppendText("Число выходов: " + Convert.ToString(NET.GetY) + "\r\n"); txtLogs.AppendText("Число скрытых слоёв: " + Convert.ToString(NET.CountLayers-1) + "\r\n"); for (int i = 0; i < NET.CountLayers - 1; i++) { txtLogs.AppendText("Нейронов в " + Convert.ToString(i + 1) + " скрытом слое: " + Convert.ToString(NET.Layer(i).countY) + "\r\n"); } } else { if (path != "") { txtLogs.AppendText("Ошибка! Файл не существует!\r\n" + path + "\r\n"); path = ""; } } }
/// <summary> /// Распознаёт символ с помощью нейронной сети /// </summary> /// <param name="path">Путь до весов сети</param> /// <param name="net">Нейронная сеть</param> /// <returns>Рагзаданные символы</returns> public static string Recognize(string path, NeuralNW net) { if (!File.Exists(path)) return null; var x = new double[net.GetX]; double[] y; string[] currFile = File.ReadAllLines(path); for (int i = 0; i < net.GetX; i++) { x[i] = Convert.ToDouble(currFile[i]); } net.NetOUT(x, out y); var numb = Array.IndexOf(y, y.Max()); switch (numb) { case 0: return "0"; case 1: return "1"; case 2: return "2"; case 3: return "3"; case 4: return "4"; case 5: return "5"; case 6: return "6"; case 7: return "7"; case 8: return "8"; case 9: return "9"; case 10: return "a"; case 11: return "b"; case 12: return "c"; case 13: return "d"; case 14: return "e"; case 15: return "f"; default: throw new ArgumentException(); } }
public IntellectBoard20AntiCaptcha() { _net = new NeuralNW(Directory.GetCurrentDirectory() + "\\..\\..\\..\\RecognizerPictures\\nwFiles\\IntellectBoard20.nw"); }
public phpBBAntiCaptcha() { _net = new NeuralNW(Directory.GetCurrentDirectory() + "\\..\\..\\..\\RecognizerPictures\\nwFiles\\phpbb.nw"); }