private void TrainPerseptron() { var folderName = AppDomain.CurrentDomain.BaseDirectory; var perFile = folderName + "\\per.data"; var imgsFolder = folderName + "\\Lightshot"; var imgsNames = Directory.GetFiles(imgsFolder); var imgToVes = new Dictionary<int[], double[]>(); for (int i = 0; i < Letters.Length; i++) { var fn = String.Format("{0}\\Screenshot_{1}.png", imgsFolder, i + 1); var img = new Bitmap(System.Drawing.Image.FromFile(fn)); var ves = new double[imgsNames.Length]; ves[i] = 1; imgToVes.Add(BitmapEditor.ImgToInts(img), ves); } System.Diagnostics.Debug.WriteLine("Training start"); Perseptron p = new Perseptron(30 * 40, 30 * 40, Letters.Length); p.Train(imgToVes); p.Save(perFile); }