Exemplo n.º 1
0
        private static void CreateTrainingData(OCR.ShapeNet ShapeNet, List <Example> Examples)
        {
            NeuralNetwork.LearningData oLearningData;
            OCR.PageComponent          PageComponent;
            sNeuralInput newInput;

            foreach (Example Example in Examples)
            {
                PageComponent = new OCR.PageComponent();
                PageComponent.LoadBitmap(Example.Filename);

                ExtractFeatures.ExecuteExtractFeatures(PageComponent, true);

                PageComponent.Position.Ascent  = ShapeNet.ShapeList[Example.ShapeId].Position.Ascent;
                PageComponent.Position.Height  = ShapeNet.ShapeList[Example.ShapeId].Position.Height;
                PageComponent.Position.Center  = ShapeNet.ShapeList[Example.ShapeId].Position.Center;
                PageComponent.Position.Base    = ShapeNet.ShapeList[Example.ShapeId].Position.Base;
                PageComponent.Position.Descent = ShapeNet.ShapeList[Example.ShapeId].Position.Descent;

                //Fill the
                oLearningData = new NeuralNetwork.LearningData();

                oLearningData.oInput.fInputs.Clear();
                oLearningData.oOutput.fOutputs.Clear();

                newInput             = RecogniseComponent.CalculateNetworkInput(PageComponent);
                oLearningData.oInput = newInput;

                for (long lIndex2 = 0; lIndex2 < ShapeNet.ShapeList.Count; lIndex2++)
                {
                    if (Example.ShapeId == lIndex2)
                    {
                        oLearningData.oOutput.fOutputs.Add(1);
                    }
                    else
                    {
                        oLearningData.oOutput.fOutputs.Add(0);
                    }
                }

                ShapeNet.NeuralNetwork.AddSituation(oLearningData);
            }

            ShapeNet.NeuralNetwork.ComputeInputRatios();
        }
Exemplo n.º 2
0
 public void AddSituation(LearningData poLearningData)
 {
     oLearningData.Add(poLearningData);
 }
Exemplo n.º 3
0
 public NetworkData Teach(LearningData data)
 {
     return(Teach(data.Input.RawValues, data.ExpectedOutput.RawValues));
 }