public void ThongKe(List<StatisticalData> _thongKe, string linkFolder, DataGridView dataGVDetail, DataGridView dataGVCorrect, DataGridView dataGVError, Label lbPercentCorrect)
        {
            ImageData imageData = new ImageData();
            string character="";
            int index;
            List<TrainingData> trainingData= imageData.ReadFolder(linkFolder);
            foreach (TrainingData training in trainingData)
            {
                 character= training.C[0]+"";
                 index=_thongKe.FindIndex(x=>x.Name==character);
                if (index>=0)
                {
                    _thongKe[index].Count++;
                }
                else
                {
                    StatisticalData temp = new StatisticalData(character);
                    temp.Count = 1;
                    _thongKe.Add(temp);
                    index = _thongKe.Count - 1;
                }

                if (character == Cal(training.p))
                {
                    _thongKe[index].CountCorrect++;
                    _thongKe[index]._listCorrect.Add(training.fileName);
                }
                else
                {
                    _thongKe[index]._listError.Add(training.fileName);
                }

            }
            _thongKe.OrderBy(x => x.Name);

            dataGVDetail.Rows.Clear();
            dataGVCorrect.Rows.Clear();
            dataGVError.Rows.Clear();

            int TotalCount = 0, TotalCountCorrect = 0;

            foreach (StatisticalData StaData in _thongKe)
            {

                TotalCount += StaData.Count;
                TotalCountCorrect += StaData.CountCorrect;

                foreach (string correct in StaData._listCorrect)
                {
                    dataGVCorrect.Rows.Add(correct);
                }

                foreach (string error in StaData._listError)
                {
                    dataGVError.Rows.Add(error);
                }

                dataGVDetail.Rows.Add(new string[] {
                    StaData.Name,
                    StaData.Count+"",
                    StaData.CountCorrect+"",
                    StaData.getPercentCorrect()+"" });
            }

            lbPercentCorrect.Text = Math.Round((TotalCountCorrect / (double)TotalCount) * 100,2) + "";
        }
예제 #2
0
        private void MLPExecute()
        {
            ImageData id = new ImageData();
            lst = id.ReadFolder(txtURL.Text);
            validData = id.ReadFolder(txtValid.Text);

            Action<List<TrainingData>> act = new Action<List<TrainingData>>((lstTD) => { lstTD.ForEach(x => { comboBox1.Items.Add(x.C); }); });
            if (comboBox1.InvokeRequired)
            {
                comboBox1.BeginInvoke(act, lst);
            }
            else
            {
                act(lst);
            }

            //mlp.updateUI = new Network.UpdateUI(UpdateUI);

            s.Start();
            mlp.Training(lst, validData);
            s.Stop();

            string time = s.Elapsed.ToString();
        }