private void StartTrainingCNN()
        {
            CNNController ctrl = new CNNController();

            ctrl.CreateAndCompileModel("model6final.json", "model6final2");

            //ctrl.WriteToFile();
            ctrl.PrepareImageSets("data/Train", "data/Test", "data/Valid");

            //ctrl.Test(2);

            while (true)
            {
                try
                {
                    ctrl.Train(416, "model6final2", 2, 0.000025);
                }
                catch (Exception e)
                {
                    ctrl.CreateAndCompileModel("model6final.json", "model6final2");
                }

                ctrl.ShuffleSets();
            }
        }
        private void EvaluateCNN()
        {
            CNNController ctrl = new CNNController();

            ctrl.CreateAndCompileModel("model6final.json", "model6final2");

            ctrl.PrepareImageSets("data/Train", "data/Test", "data/Valid");

            ctrl.EvaluateModel();
        }
        public char GetPrediction(CNNController ctrl)
        {
            using (Bitmap img = new Bitmap(imagePath))
            {
                Bitmap bmp = ImageProcessing.CropWhite(img, 75, 75);
                bmp.RotateFlip(RotateFlipType.Rotate180FlipNone);

                img.Dispose();

                return(ctrl.RecogniseImage(bmp));
            }
        }
        private void StartTrainingTasks()
        {
            Task[] tasks = new Task[2];

            tasks[0] = Task.Run(() =>
            {
                try
                {
                    CNNController ctrl = new CNNController();
                    ctrl.CreateAndCompileModel5();
                    ctrl.WriteToFile("model5final.json", "model5final");
                    ctrl.PrepareImageSets("data/Train", "data/Test", "data/Valid");

                    //ctrl.Test(1);

                    ctrl.Train(208, "model5final", 1, 0.05);
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Process 1: " + ex.Message);
                }
            });

            tasks[1] = Task.Run(() =>
            {
                try
                {
                    CNNController ctrl = new CNNController();
                    ctrl.CreateAndCompileModel6();
                    ctrl.WriteToFile("model6final.json", "model6final");
                    ctrl.PrepareImageSets("data/Train", "data/Test", "data/Valid");

                    ctrl.Test(2);

                    ctrl.Train(416, "model6final", 2, 0.005);
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Process 2: " + ex.ToString());
                }
            });

            Task.WaitAll(tasks);
        }