Beispiel #1
0
        public void TestNetwork(MNistImage[] images, CancellationToken cancellation)
        {
            Debug.AssertNotNull(images);
            Debug.AssertNotNull(cancellation);

            if (_statRefresher != null && _statRefresher.Started) return;

            _cancelTrainToken = cancellation;

            var normalImages = new NormalizedImage[images.Length];
            for (var i = 0; i < images.Length; i++)
            {
                normalImages[i] = new NormalizedImage(images[i]);
                normalImages[i].PadCanvas(Network.InputImageWidth, Network.InputImageHeight);
            }

            _testInfoBuffer.Clear();
            _imageProcessed = 0;
            _errors.Clear();
            _totalMSE = 0.0;

            _statRefresher = new ActionRepeater(PrintTestingInfo, 1000.0);
            _statRefresher.Start(false);

            TestProcess(normalImages);

            _statRefresher.Stop(true);
            History = txtStatistics.Text;
        }
Beispiel #2
0
        public void TrainNetwork(MNistImage[] images, CancellationToken cancellation)
        {
            Debug.AssertNotNull(images);
            Debug.Assert(cancellation != null);
            if (_statRefresher != null && _statRefresher.Started) return;

            _cancelTrainToken = cancellation;

            var normalImages = new NormalizedImage[images.Length];
            for (var i = 0; i < images.Length; i++)
                normalImages[i] = new NormalizedImage(images[i]);

            _statRefresher = new ActionRepeater(PrintTrainingInfo, 1000.0);
            _statRefresher.Start(false);

            TrainProcess(normalImages);

            _statRefresher.Stop(true);
            History = txtStatistics.Text;
        }