Exemplo n.º 1
0
        private Task <ISupervisedModel> GetModel(ISupervisedTrainer trainer)
        {
            Progress <ClusteringProgress> progress = new Progress <ClusteringProgress>(ReportProgress);

            return(trainer.TrainAsync(_trainingImage, bandSelectorControl.SelectedBands, _clusteringImage, SelectedClusteringBand,
                                      progress, _cancellationTokenSource.Token));
        }
Exemplo n.º 2
0
        private async void TryTrainingAsync(ISupervisedTrainer trainer)
        {
            try
            {
                StartProgress();
                Model = await GetModel(trainer);

                EndProgress();
                AcceptResult();
            }
            catch (ArgumentException)
            {
                EndProgress();
                ShowPixelCountErrorMessage();
            }
            catch (OperationCanceledException)
            {
                InterruptionInProgress(false);
                EndProgress();
            }
        }