예제 #1
0
        /// <summary>
        ///
        /// </summary>

        #endregion

        #region Main function
        public NNTrainPatterns(NeuralNetwork neuronNet, MnistDatabase trainingSet, Preferences preferences, bool trainingDataReady,
                               ManualResetEvent eventStop,
                               ManualResetEvent eventStopped,
                               HandwrittenRecogniration.Mainform form, List <Mutex> mutexs)
        {
            m_currentPatternIndex = 0;
            _bDataReady           = trainingDataReady;
            _NN                = neuronNet;
            _MnistDataSet      = trainingSet;
            m_Preferences      = preferences;
            m_nImages          = (uint)_MnistDataSet.m_pImagePatterns.Count;
            _form              = form;
            m_EventStop        = eventStop;
            m_EventStopped     = eventStopped;
            m_Mutexs           = mutexs;
            m_cMisrecognitions = 0;
            _iNextPattern      = 0;
            m_bNeedHessian     = true;
            m_cBackprops       = 0;
            _dMSE              = 0;
            _nn                = 0;
            _dMSE200           = 0;
            m_HiPerfTime       = new HiPerfTimer();
            GetGaussianKernel(m_Preferences.m_dElasticSigma);
        }
예제 #2
0
        public Mainform()
        {
            InitializeComponent();
            _Preference            = new Preferences();
            _MnistTrainingDatabase = new MnistDatabase();
            _MinstTestingDatabase  = new MnistDatabase();
            _Mnistdatabase         = _MinstTestingDatabase;
            _icurrentMnistPattern  = 0;
            _bTrainingDataReady    = false;
            _bTestingDataReady     = false;
            _bDatabaseReady        = _bTestingDataReady;
            radioButtonMnistTestDatabase.Checked  = true;
            radioButtonMnistTrainDatabase.Checked = false;
            pictureBox2.SizeMode = PictureBoxSizeMode.StretchImage;

            //Create Neural net work
            _NN         = new NeuralNetwork();
            _TrainingNN = new NeuralNetwork();
            CreateNNNetWork(_NN);
            // initialize delegates
            _DelegateAddObject = new DelegateAddObject(this.AddObject);

            // initialize events
            _EventTrainingStopThread    = new ManualResetEvent(false);
            _EventTrainingThreadStopped = new ManualResetEvent(false);
            _EventTestingStopThread     = new ManualResetEvent(false);
            _EventTestingThreadStopped  = new ManualResetEvent(false);
            _trainer_threads            = null;
            _MainMutex             = new Mutex();
            _mnistWeightsFile      = "";
            _bTrainingThreadRuning = false;
            _bTestingThreadRuning  = false;
        }
예제 #3
0
파일: Test.cs 프로젝트: andromede76/RNC
 public Test(ReseauNeurone neuronet, MnistDatabase baseTest, FormPrincipal frm)
 {
     _RNN = neuronet;
     BaseApprentissage     = baseTest;
     nombre                = BaseApprentissage.imageCount;
     erreurReconnaissances = 0;
     _form        = frm;
     m_HiPerfTime = new HiPerfTimer();
 }
예제 #4
0
파일: Test.cs 프로젝트: andromede76/RNC
        public Test(ReseauNeurone neuronet, MnistDatabase baseTest, FormPrincipal frm, int entree, int sortie, int taille)
        {
            _RNN = neuronet;
            BaseApprentissage     = baseTest;
            nombre                = BaseApprentissage.imageCount;
            erreurReconnaissances = 0;
            _form        = frm;
            m_HiPerfTime = new HiPerfTimer();

            this.Entree = entree;
            this.Sortie = sortie;
            this.Taille = taille;
        }
예제 #5
0
 private void radioButton2_CheckedChanged(object sender, EventArgs e)
 {
     if (radioButtonMnistTestDatabase.Checked)
     {
         _Mnistdatabase        = _MinstTestingDatabase;
         _bDatabaseReady       = _bTestingDataReady;
         _icurrentMnistPattern = 0;
     }
     else
     {
         _Mnistdatabase        = _MinstTestingDatabase;
         _bDatabaseReady       = _bTrainingDataReady;
         _icurrentMnistPattern = 0;
     }
 }
예제 #6
0
        public Apprentissage(ReseauNeurone neuronet, MnistDatabase baseApprentissage, int nombreSorties, FormPrincipal frm, Boolean distorsion)
        {
            _RNN = neuronet;
            BaseApprentissage     = baseApprentissage;
            nombre                = baseApprentissage.imageCount;
            NombreSorties         = nombreSorties;
            erreurReconnaissances = 0;
            bonneReconnaissances  = 0;
            nombreBackPropagation = 0;
            _iEpochsCompleted     = 0;
            _form        = frm;
            m_HiPerfTime = new HiPerfTimer();
            archive      = new Archive();

            this.Distorsion = distorsion;
        }
예제 #7
0
 private void mNISTDatabaseToolStripMenuItem_Click(object sender, EventArgs e)
 {
     _bTrainingDataReady = _MnistTrainingDatabase.LoadMinstFiles();
     if (_bTrainingDataReady)
     {
         //update Preferences parametters
         if (_MnistTrainingDatabase.m_pImagePatterns.Count != _Preference.m_nItemsTrainingImages)
         {
             _Preference.m_nItemsTrainingImages = (uint)_MnistTrainingDatabase.m_pImagePatterns.Count;
             _Preference.m_nItemsTrainingLabels = (uint)_MnistTrainingDatabase.m_pImagePatterns.Count;
         }
         radioButtonMnistTrainDatabase.Enabled = true;
         radioButtonTrainingdatabase.Enabled   = true;
         buttonMnistNext.Enabled     = true;
         buttonMnistPrevious.Enabled = true;
         _bDatabaseReady             = _bTrainingDataReady;
         _Mnistdatabase = _MnistTrainingDatabase;
     }
     else
     {
         radioButtonMnistTrainDatabase.Enabled = false;
         return;
     }
     _bTestingDataReady = _MinstTestingDatabase.LoadMinstFiles();
     if (_bTestingDataReady)
     {
         //update Preferences parametters
         if (_MinstTestingDatabase.m_pImagePatterns.Count != _Preference.m_nItemsTestingImages)
         {
             _Preference.m_nItemsTestingImages = (uint)_MinstTestingDatabase.m_pImagePatterns.Count;
             _Preference.m_nItemsTestingLabels = (uint)_MinstTestingDatabase.m_pImagePatterns.Count;
         }
         radioButtonMnistTestDatabase.Enabled = true;
         radioButtonMnistTestDatabase.Checked = true;
         radioButtonTestingdatabase.Enabled   = true;
         radioButtonTestingdatabase.Checked   = true;
         buttonMnistNext.Enabled     = true;
         buttonMnistPrevious.Enabled = true;
         _bDatabaseReady             = _bTestingDataReady;
         _Mnistdatabase = _MinstTestingDatabase;
     }
     else
     {
         radioButtonMnistTestDatabase.Enabled = false;
         return;
     }
 }
예제 #8
0
        public NNTestPatterns(NeuralNetwork neuronNet, Preferences preferences,
                              HandwrittenRecogniration.Mainform form, List <Mutex> mutexs)
        {
            m_currentPatternIndex = 0;
            _bDataReady           = true;
            _NN            = neuronNet;
            _iNextPattern  = 0;
            m_EventStop    = null;
            m_EventStopped = null;
            _form          = form;
            m_HiPerfTime   = new HiPerfTimer();
            m_nImages      = 0;
            _iMisNum       = 0;

            //Initialize Gaussian Kernel
            m_Preferences = preferences;
            GetGaussianKernel(preferences.m_dElasticSigma);
            _MnistDataSet = null;
            m_Mutexs      = mutexs;
        }
예제 #9
0
        public NNTestPatterns(NeuralNetwork neuronNet, MnistDatabase testtingSet, Preferences preferences, bool testingDataReady,
                              ManualResetEvent eventStop,
                              ManualResetEvent eventStopped,
                              HandwrittenRecogniration.Mainform form, List <Mutex> mutexs)
        {
            m_currentPatternIndex = 0;
            _bDataReady           = testingDataReady;
            _NN            = neuronNet;
            _iNextPattern  = 0;
            m_EventStop    = eventStop;
            m_EventStopped = eventStopped;
            _form          = form;
            m_HiPerfTime   = new HiPerfTimer();
            m_nImages      = (uint)testtingSet.m_pImagePatterns.Count;

            //Initialize Gaussian Kernel
            m_Preferences = preferences;
            GetGaussianKernel(preferences.m_dElasticSigma);
            _MnistDataSet = testtingSet;
            m_Mutexs      = mutexs;
        }