예제 #1
0
        private void button_Close_Click(object sender, EventArgs e)
        {
            if (bStarted)
            {
                timer1.Stop();
            }

            // Save the weights to data files
            Cursor = Cursors.WaitCursor;
            WeightFile wf = new WeightFile();

            wf.SetConfidence(confidence);
            wf.SaveSettings(nbOfUnits_1, nbOfUnits_2, nbOfUnits_3);
            wf.SaveWeights(Weights, nbOfUnits_1, nbOfUnits_2, nbOfUnits_3);
            Cursor = Cursors.Default;

            Close();
        }
예제 #2
0
        private void button_Clear_Click(object sender, EventArgs e)
        {
            MessageBoxButtons buttons = MessageBoxButtons.YesNo;
            DialogResult      result;

            result = MessageBox.Show("Are you sure, that the current weights can be discarded?",
                                     "Warning", buttons, MessageBoxIcon.Question);
            if (result == DialogResult.Yes)
            {
                // init. the Weights
                InitializeWeights();
            }

            WeightFile wf = new WeightFile();

            wf.Clean();

            label_Processed.Text    = "Processed:          ";
            label_OverallError.Text = "Overall:        ";
            label_MaxError.Text     = "Maximum:        ";
        }
예제 #3
0
        private void Learn_Shown(object sender, EventArgs e)
        {
            // show the current number of teacher data
            TeacherFile tf = new TeacherFile();

            tf.SetFeatureNumber(NBOFFEATURES);
            NbOfFileNames                   = tf.GetNextDataFileID() - 1;
            label_NbofFiles.Text            = "Number of used image files:  " + Convert.ToString(NbOfFileNames);
            NbofTeachers                    = tf.GetNumberOfTeachers();
            label_NbofTeachers.Text         = "Number of defined teachers:  " + Convert.ToString(NbofTeachers);
            numericUpDown_Convergence.Value = Convert.ToDecimal(factor);

            int NbofWeights = nbOfUnits_1 + nbOfUnits_1 * nbOfUnits_2 + nbOfUnits_2 * nbOfUnits_3;

            Array.Resize(ref Weights, NbofWeights);
            for (int ii = 0; ii < NbofWeights; ii++)
            {
                Weights[ii] = 0.0;
            }

            // Load the weights from data file
            WeightFile wf = new WeightFile();

            Cursor = Cursors.WaitCursor;
            bool bSuccess;

            bSuccess = wf.LoadWeights(Weights, nbOfUnits_1, nbOfUnits_2, nbOfUnits_3);
            Cursor   = Cursors.Default;
            if (!bSuccess)
            {
                MessageBox.Show("'Weights_File' data file is missing or injured - start working with random weights.");
                InitializeWeights();
            }

            timer1.Interval = 1;  // let the teaching timer's interval: 1 msec
            bStarted        = false;
        }