コード例 #1
0
        /// <summary>
        /// Network learns new curve
        /// (adds curve to collection and runs training )
        /// </summary>
        /// <param name="curve">Curve</param>
        public void LearnNewCurve(ClassicCurve curve)
        {
            int position = FindFreePosition();

            if (position == -1)
            {
                // maximum amount of gestures that can be learnt is reached
                return;
            }

            StopLearning(); //just for sure...
            //if (threadTrainNetwork != null && threadTrainNetwork.IsAlive)
            //    threadTrainNetwork.Abort();
            //if (m_newCurveAdded) m_curves.RemoveAt(m_curves.Count - 1);

            MyCurve curveToTrain = new MyCurve(curve.ID, curve.Points);

            curve.NnIndex = position;
            curveToTrain.CreateTrainingSet();

            // Might happen that curve sets is not compatible with curves
            // therefore it is required to reinicialize it
            if (m_curveSets.ContainsKey(curve.ID))
            {
                CreateTrainingSet();
            }

            m_curveSets.Add(curve.ID, curveToTrain);
            m_curves.Add(curve.ID, curve);

            InitializeNetwork();
            OnNetworkStartTraining();
            threadTrainNetwork = new Thread(new ThreadStart(TrainNeuralNetwork));
            threadTrainNetwork.Start();
        }
コード例 #2
0
 private void CreateTrainingSet()
 {
     m_curveSets = new Dictionary <string, MyCurve>();
     foreach (ClassicCurve curve in m_curves.Values)// ClassicCurve curve in m_curves)
     {
         MyCurve c = new MyCurve(curve.ID, curve.Points);
         c.CreateTrainingSet();
         m_curveSets.Add(curve.ID, c);
     }
 }
コード例 #3
0
        /// <summary>
        /// Network learns new curve 
        /// (adds curve to collection and runs training )
        /// </summary>
        /// <param name="curve">Curve</param>
        public void LearnNewCurve(ClassicCurve curve)
        {
            int position = FindFreePosition();
            if (position == -1)
            {
                // maximum amount of gestures that can be learnt is reached
                return;
            }
            
            StopLearning(); //just for sure...
            //if (threadTrainNetwork != null && threadTrainNetwork.IsAlive)
            //    threadTrainNetwork.Abort();
            //if (m_newCurveAdded) m_curves.RemoveAt(m_curves.Count - 1);
            
            MyCurve curveToTrain = new MyCurve(curve.ID, curve.Points);            
            curve.NnIndex = position;           
            curveToTrain.CreateTrainingSet();

            // Might happen that curve sets is not compatible with curves 
            // therefore it is required to reinicialize it
            if (m_curveSets.ContainsKey(curve.ID))
                CreateTrainingSet();
            
            m_curveSets.Add(curve.ID, curveToTrain);
            m_curves.Add(curve.ID, curve);

            InitializeNetwork();
            OnNetworkStartTraining();
            threadTrainNetwork = new Thread(new ThreadStart(TrainNeuralNetwork));
            threadTrainNetwork.Start();
        }
コード例 #4
0
 private void CreateTrainingSet()
 {
     m_curveSets = new Dictionary<string, MyCurve>();
     foreach (ClassicCurve curve in m_curves.Values)// ClassicCurve curve in m_curves)
     {
         MyCurve c = new MyCurve(curve.ID, curve.Points);
         c.CreateTrainingSet();
         m_curveSets.Add(curve.ID, c);
     }
 }