Beispiel #1
0
        private void btn_CNN_learn_Click(object sender, EventArgs e)
        {
            if (network.IsLearned())
            {
                DialogResult result = MessageBox.Show("Network is already teached. Teach again?", "", MessageBoxButtons.YesNo);
                if (result == DialogResult.No)
                {
                    return;
                }
            }

            if (tb_cascade_path.Text == "")
            {
                MessageBox.Show("Please choose path to folder with at least 1 cascade", "ERROR");
                return;
            }
            if (!Directory.Exists(tb_cascade_path.Text))
            {
                MessageBox.Show("Cascade Folder does not exists", "ERROR");
                return;
            }
            if ((trainFolder != null) && (testFolder != null))
            {
                int acc;
                Int32.TryParse(tb_network_acc.Text, out acc);
                int    BatchSize = 100;
                float  LearnRate = 0.01f;
                float  momentum  = 0.85f;
                double d         = network.TeachCNN(trainFolder.GetPath(), recognizeImageFolder.GetPath(), acc, LearnRate, BatchSize, momentum);
                if (d == -1)
                {
                    MessageBox.Show("Please add layers and try again");
                }
                else
                {
                    lAccuracy.Text = d.ToString();
                    Int32.TryParse(d.ToString(), out aim);
                }
                if (network.IsLearned())
                {
                    lLearned.Text = "Learned";
                    MessageBox.Show("Network is learned acc is " + lAccuracy.Text);
                }
            }
        }