コード例 #1
0
 private void m_solver_OnTrainingIteration(object sender, TrainingIterationArgs <T> e)
 {
     if (m_sw.Elapsed.TotalMilliseconds > 1000)
     {
         m_dfLastLoss         = e.SmoothedLoss;
         m_dfLastLearningRate = e.LearningRate;
         updateStatus(e.Iteration, m_solver.MaximumIteration, e.Accuracy, e.SmoothedLoss, e.LearningRate);
         m_sw.Restart();
     }
 }
コード例 #2
0
        /// <summary>
        /// Event called on each training iterations.
        /// </summary>
        /// <param name="sender">Specifies who sent the event.</param>
        /// <param name="e">Specifies the event parameters.</param>
        private void m_mycaffe_OnTrainingIteration(object sender, TrainingIterationArgs <float> e)
        {
            if (m_swTraining.Elapsed.TotalMilliseconds > 1000)
            {
                Console.WriteLine("Iteration = " + e.Iteration.ToString("N0") + " Loss = " + e.SmoothedLoss.ToString());
                m_swTraining.Restart();
            }

            if (e.Iteration % 30 == 0)
            {
                m_plots.Add(e.Iteration, e.SmoothedLoss);
            }
        }
コード例 #3
0
ファイル: FormMain.cs プロジェクト: MyCaffe/MyCaffe-Samples
        /// <summary>
        /// Called on each training iteration of the input model used to detect each hand written character.
        /// </summary>
        /// <param name="sender">Specifies the event sender.</param>
        /// <param name="e">Specifies the event args.</param>
        private void m_mycaffeInput_OnTrainingIteration(object sender, TrainingIterationArgs <float> e)
        {
            if (m_sw.Elapsed.TotalMilliseconds > 1000)
            {
                m_log.Progress = e.Iteration / (double)m_model.Iterations;
                m_log.WriteLine("MNIST Iteration " + e.Iteration.ToString() + " of " + m_model.Iterations.ToString() + ", loss = " + e.SmoothedLoss.ToString());
                m_sw.Restart();

                m_plotsInputLoss.Add(e.Iteration, e.SmoothedLoss);
                Image img = SimpleGraphingControl.QuickRender(m_plotsInputLoss, pbImage.Width, pbImage.Height, false, null, null, true, m_rgZeroLine);
                m_bw.ReportProgress(1, img);
            }
        }
コード例 #4
0
        private void Solver_OnTrainingIteration(object sender, TrainingIterationArgs <T> e)
        {
            m_log.WriteLine("Iteration = " + e.Iteration.ToString() + " - Loss = " + e.SmoothedLoss.ToString());

            if (double.IsNaN(e.Loss))
            {
                m_log.WriteError(new Exception("Loss = NAN!"));
                m_evtCancel.Set();
                return;
            }

            if (double.IsInfinity(e.Loss))
            {
                m_log.WriteError(new Exception("Loss = Infinity!"));
                m_evtCancel.Set();
                return;
            }
        }
コード例 #5
0
        /// <summary>
        /// Called on each training iteration of the sequence model used to encode each detected hand written character
        /// and then decode the encoding into the proper section of the Sin curve.
        /// </summary>
        /// <param name="sender">Specifies the event sender.</param>
        /// <param name="e">Specifies the event args.</param>
        private void m_mycaffe_OnTrainingIteration(object sender, TrainingIterationArgs <float> e)
        {
            if (m_sw.Elapsed.TotalMilliseconds > 1000)
            {
                m_log.Progress = e.Iteration / (double)m_model.Iterations;
                m_log.WriteLine("Seq2Seq Epoch " + m_nTotalEpochs.ToString() + " Sequence " + m_nTotalSequences.ToString() + " Iteration " + e.Iteration.ToString() + " of " + m_model.Iterations.ToString() + ", loss = " + e.SmoothedLoss.ToString(), true);
                m_sw.Restart();

                m_fTotalCost += (float)e.SmoothedLoss;
                m_nTotalIter1++;
                float fLoss = m_fTotalCost / m_nTotalIter1;

                m_plotsSequenceLoss.Add(m_nTotalSequences, fLoss);
                if (m_plotsSequenceLoss.Count > 2000)
                {
                    m_plotsSequenceLoss.RemoveAt(0);
                }

                Image img = SimpleGraphingControl.QuickRender(m_plotsSequenceLoss, pbImageLoss.Width, pbImageLoss.Height, false, null, null, true, m_rgZeroLine);
                m_bw.ReportProgress(1, new Tuple <Image, int>(img, 0));
            }
        }
コード例 #6
0
        private void ctrl_OnTrainingIteration(object sender, TrainingIterationArgs <T> e)
        {
            double dfPct = (double)e.Iteration / m_nMaxIteration;

            m_progress.SetProgress(dfPct);
        }