コード例 #1
0
        void Classifier_ClassificationCompleted(object sender, ClassificationEventArgs e)
        {
            classifier.ClassificationCompleted -= Classifier_ClassificationCompleted;

            Result result = null;

            if (e.Classifications.Any())
            {
                var classificationResult = e.Classifications.OrderByDescending(x => x.Value).First();

                result = new Result()
                {
                    IsHotdog   = classificationResult.Key == "hotdog",
                    Confidence = classificationResult.Value,
                    PhotoBytes = bytes
                };
            }
            else
            {
                result = new Result()
                {
                    IsHotdog   = false,
                    Confidence = 1.0f,
                    PhotoBytes = bytes
                };
            }

            var view = Resolver.Resolve <ResultView>();

            ((ResultViewModel)view.BindingContext).Initialize(result);

            Navigation.PushAsync(view);
        }
コード例 #2
0
        private void DefaultClassifier_ClassificationCompleted(object sender, ClassificationEventArgs e)
        {
            var result = e.Predictions.Select(x => new ViewM_CameraX.ClassifyResult
            {
                Percent = x.Probability,
                Tag     = x.TagName
            });

            ViewModel.ClassificationCompleted(result.ToList());
        }
コード例 #3
0
        private void Classifier_ClassificationCompleted(object sender, ClassificationEventArgs e)
        {
            var sortedList = e.Predictions.OrderByDescending(x => x.Probability);

            var top_prediction = sortedList.First();

            String results = "This is: " + top_prediction.TagName + " \n Accuracy: " + top_prediction.Probability * 100;

            ResultInfo = results;

            ((IClassifier)sender).ClassificationCompleted -= Classifier_ClassificationCompleted;
        }
コード例 #4
0
        private void Classifier_ClassificationCompleted(object sender, ClassificationEventArgs e)
        {
            var sortedList = e.Predictions.OrderByDescending(x => x.Probability);

            var top = sortedList.First();

            if (top.Probability >= 0.9)
            {
                var mushroom = mushrooms.Single(x => x.LatinName.ToLower() == top.TagName.ToLower());

                Navigation.NavigateToAsync("ResultView", mushroom);
            }

            var classifier = (IClassifier)sender;

            classifier.ClassificationCompleted -= Classifier_ClassificationCompleted;
        }
コード例 #5
0
        void a_faceReaderController_ClassificationReceived(object sender, ClassificationEventArgs e)
        {
            // get the classification from the event arguments
            FaceReaderAPI.Data.Classification classification = e.Classification;

            // if a classification was received
            if (classification != null)
            {
                // if the classification is in the form of a StateLogs
                if (classification.LogType == FaceReaderAPI.Data.LogType.StateLog)
                {
                    // show the information
                    WriteInfo(rtbStateClassification, classification.ToString());
                }
                // if the classification is in the form of a DetailedLog
                else
                {
                    // show the information
                    WriteInfo(rtbDetailedClassification, classification.ToString());
                }
            }
        }
コード例 #6
0
ファイル: FaceReading.cs プロジェクト: Zebreu/louisjvi
    void a_faceReaderController_ClassificationReceived(object sender, ClassificationEventArgs e)
    {
        // get the classification from the event arguments
        FaceReaderAPI.Data.Classification classification = e.Classification;

        // if a classification was received
        if (classification != null)
        {
            // if the classification is in the form of a StateLogs
            if (classification.LogType == FaceReaderAPI.Data.LogType.StateLog)
            {
                // show the information
                faceReaderOutput.Add(classification.ToString());
            }
            // if the classification is in the form of a DetailedLog
            else
            {
                // show the information
                faceReaderOutput.Add(classification.ToString());
            }
        }
    }
コード例 #7
0
        private void DefaultClassifier_ClassificationCompleted(object sender, ClassificationEventArgs e)
        {
            isClassifyDone = true;
            var content = new List <ResultObj>();

            if (e.Predictions != null && e.Predictions.Any())
            {
                var classifyResult = from j in e.Predictions
                                     join k in ListMat2Lable on j.TagName equals k.MatCode
                                     select new
                {
                    j.Probability,
                    k.MatName,
                };
                var orderResult =
                    classifyResult.OrderByDescending(x => x.Probability)
                    .Take(3)
                    .Select(x => new ResultObj {
                    Name = x.MatName, Probability = x.Probability
                });
                content.AddRange(orderResult);
            }
            ClassifyCompleteEvent?.Invoke(this, content);
        }