void HandleClassifications(VNRequest request, NSError error)
        {
            DispatchQueue.MainQueue.DispatchAsync(() =>
            {
                var observations = request.GetResults <VNClassificationObservation>();
                if (observations == null)
                {
                    Debug.WriteLine("Error: no results");
                    _machineLearningTask.TrySetResult(null);
                    return;
                }

                var best = observations[0];
                if (best == null)
                {
                    Debug.WriteLine("Error: no observations");
                    _machineLearningTask.TrySetResult(null);
                    return;
                }

                var result = new MachineLearningResult();

                foreach (var observation in observations)
                {
                    result.Observations.Add(new Observation {
                        Confidence = observation.Confidence, Identifier = observation.Identifier
                    });
                }

                _machineLearningTask.TrySetResult(result);
            });
        }
Beispiel #2
0
        void HandleBarCodes(VNRequest request, NSError error)
        {
            if (error != null)
            {
                _barcodeResult.SetException(new NSErrorException(error));
                return;
            }
            var observations = request.GetResults <VNBarcodeObservation>();
            var result       = new VisionBarCodeResult();

            result.Success   = true;
            result.Timestamp = DateTime.Now.Ticks;
            foreach (var o in observations)
            {
                if (result.Results == null)
                {
                    result.Results = new List <BarCodeResult>();
                }
                var res = new BarCodeResult
                {
                    Text   = o.PayloadStringValue,
                    X      = o.TopLeft.X,
                    Y      = o.TopLeft.Y,
                    Width  = o.TopRight.X - o.TopLeft.X,
                    Height = o.BottomLeft.Y - o.TopLeft.Y,
                };
                result.Results.Add(res);
                Logger.Log($"Found bar code {res.Text} {res.X} {res.Y} {res.Width} {res.Height}");
            }
            _barcodeResult.SetResult(result);
        }
        /// <summary>
        /// Handle completion of the Vision request and choose results to display.
        /// </summary>
        private void ProcessClassifications(VNRequest request, NSError error)
        {
            var classifications = request.GetResults <VNClassificationObservation>();

            if (classifications == null)
            {
                Console.WriteLine($"Unable to classify image.\n{error.LocalizedDescription}");
            }

            // Show a label for the highest-confidence result (but only above a minimum confidence threshold).
            var bestResult = classifications.FirstOrDefault(result => result.Confidence > 0.5f);

            if (bestResult != null)
            {
                this.identifierString = bestResult.Identifier.Split(',')[0];
                this.confidence       = bestResult.Confidence;
            }
            else
            {
                this.identifierString = string.Empty;
                this.confidence       = 0f;
            }

            DispatchQueue.MainQueue.DispatchAsync(() => this.DisplayClassifierResults());
        }
        void HandleClassificationRequest(VNRequest request, NSError error)
        {
            var observations = request.GetResults <VNClassificationObservation>();
            var best         = observations?[0];

            outputLabel.Text = $"{best.Identifier.Trim()}, {best.Confidence:P0}";
        }
        // MARK: Handle image classification results
        public void handleClassification(VNRequest request, NSError error)
        {
            var observations = request.GetResults <VNClassificationObservation>();

            if (observations == null)
            {
                Console.WriteLine("Error: no results");
            }

            var best = observations[0];

            if (best == null)
            {
                Console.WriteLine("Error: no observations");
            }

            // Use results to update user interface (includes basic filtering)
            Console.WriteLine($"{best.Identifier}: {best.Confidence:P0}");
            if (best.Identifier.IndexOf("Unknown", StringComparison.InvariantCulture) > -1 ||
                best.Confidence < confidence)
            {
                if (unknownCounter < 3)
                {                   // a bit of a low-pass filter to avoid flickering
                    unknownCounter++;
                }
                else
                {
                    unknownCounter = 0;
                    DispatchQueue.MainQueue.DispatchAsync(() =>
                    {
                        bubbleLayer.String = "";
                    });
                }
            }
            else
            {
                unknownCounter = 0;
                var className = best.Identifier.Trim();
                Console.WriteLine("Identified: " + className);

                DispatchQueue.MainQueue.DispatchAsync(() =>
                {
                    var confidenceString = best.Confidence.ToString("P0", new NumberFormatInfo {
                        PercentPositivePattern = 1
                    });
                    if (className == "benign")
                    {
                        bubbleLayer.BackgroundColor = new UIColor(0, 1, 217 / 255, 1).CGColor;
                        bubbleLayer.String          = $"All clear ({confidenceString})";
                    }
                    else
                    {
                        bubbleLayer.BackgroundColor = new UIColor(1, 0, 217 / 255, 1).CGColor;
                        bubbleLayer.String          = $"See doctor! ({confidenceString})";
                    }
                });
            }
        }
Beispiel #6
0
        void HandleRectangles(VNRequest request, NSError error)
        {
            var observations = request.GetResults <VNRectangleObservation>();

            if (observations == null)
            {
                ShowAlert("Processing Error", "Unexpected result type from VNDetectRectanglesRequest.");
                return;
            }
            if (observations.Length < 1)
            {
                DispatchQueue.MainQueue.DispatchAsync(() => {
                    ClassificationLabel.Text = "No rectangles detected.";
                });
                return;
            }

            var  summary         = "";
            var  imageSize       = InputImage.Extent.Size;
            bool atLeastOneValid = false;

            Console.WriteLine("Rectangles:");
            summary += "Rectangles:" + Environment.NewLine;
            foreach (var o in observations)
            {
                // Verify detected rectangle is valid.
                var boundingBox = o.BoundingBox.Scaled(imageSize);
                if (!InputImage.Extent.Contains(boundingBox))
                {
                    Console.WriteLine(" --- Rectangle out of bounds: " + ToShortString(boundingBox));
                    summary += " --- Rectangle out of bounds:" + ToShortString(boundingBox) + Environment.NewLine;
                }
                else
                {
                    Console.WriteLine(ToShortString(o.BoundingBox));
                    summary         += ToShortString(o.BoundingBox) + Environment.NewLine;
                    atLeastOneValid |= true;
                }
            }

            if (!atLeastOneValid)
            {
                DispatchQueue.MainQueue.DispatchAsync(() => {
                    ClassificationLabel.Text = "No _valid_ rectangles detected." + Environment.NewLine + summary;
                });
                return;
            }

            // Show the pre-processed image
            DispatchQueue.MainQueue.DispatchAsync(() =>
            {
                ClassificationLabel.Text  = summary;
                ClassificationLabel.Lines = 0;
                ImageView.Image           = OverlayRectangles(RawImage, imageSize, observations);
            });
        }
        public void HandleClassificationRequest(VNRequest request, NSError error)
        {
            var observations = request.GetResults <VNClassificationObservation>();
            var best         = observations?[0];

            var bestTag    = best.Identifier.Trim();
            var confidence = $"{best.Confidence:P0}";

            picResults = new Tuple <string, string>(bestTag, confidence);
        }
        private void HandleVNRequest(VNRequest request, NSError error)
        {
            if (error != null)
            {
                ClassificationCompleted?.Invoke(this, new ClassificationEventArgs(new Dictionary <string, float>()));
            }

            var result          = request.GetResults <VNClassificationObservation>();
            var classifications = result.OrderByDescending(x => x.Confidence).ToDictionary(x => x.Identifier, x => x.Confidence);

            ClassificationCompleted?.Invoke(this, new ClassificationEventArgs(classifications));
        }
        private void HandleVNRequest(VNRequest request, NSError error)
        {
            if (error != null)
            {
                ClassificationCompleted?.Invoke(this, new ClassificationEventArgs(new List <Classification>()));
            }

            var result          = request.GetResults <VNClassificationObservation>();
            var classifications = result.OrderByDescending(x => x.Confidence).Select(x => new Classification(x.Identifier, x.Confidence)).ToList();

            ClassificationCompleted?.Invoke(this, new ClassificationEventArgs(classifications));
        }
        void HandleVNRequest(VNRequest request, NSError error)
        {
            classifying = false;

            if (error != null)
            {
                return;
            }

            var observations = request.GetResults <VNClassificationObservation>().OrderByDescending(x => x.Confidence).ToList();

            foreach (var o in observations)
            {
                Console.WriteLine($"{o.Identifier} == {o.Confidence}");
            }

            ShowObservation(observations.First());
        }
Beispiel #11
0
        // MARK: Handle image classification results
        public void handleClassification(VNRequest request, NSError error)
        {
            var observations = request.GetResults <VNClassificationObservation>();

            if (observations == null)
            {
                Console.WriteLine("Error: no results");
            }

            var best = observations[0];

            if (best == null)
            {
                Console.WriteLine("Error: no observations");
            }

            // Use results to update user interface (includes basic filtering)
            Console.WriteLine($"{best.Identifier}: {best.Confidence:P0}");
            if (best.Identifier.IndexOf("Unknown", StringComparison.InvariantCulture) > -1 ||
                best.Confidence < confidence)
            {
                if (unknownCounter < 3)
                {                   // a bit of a low-pass filter to avoid flickering
                    unknownCounter++;
                }
                else
                {
                    unknownCounter = 0;
                    DispatchQueue.MainQueue.DispatchAsync(() =>
                    {
                        bubbleLayer.String = "";
                    });
                }
            }
            else
            {
                unknownCounter = 0;
                Console.WriteLine("Identified: " + best.Identifier.Trim());
                DispatchQueue.MainQueue.DispatchAsync(() =>
                {
                    bubbleLayer.String = $"{best.Identifier.Trim()} : {best.Confidence:P0}";
                });
            }
        }
        public void RecognizeTextHandler(VNRequest request, NSError error)
        {
            List <string> numbers    = new List <string> ();
            List <CGRect> redBoxes   = new List <CGRect> ();
            List <CGRect> greenBoxes = new List <CGRect> ();

            var results           = request.GetResults <VNRecognizedTextObservation> ();
            var maximumCandidates = 1;

            foreach (var visionResult in results)
            {
                var candidate = visionResult.TopCandidates((nuint)maximumCandidates) [0];
                if (candidate != null)
                {
                    var numberIsSubstring = true;
                    var result            = candidate.String.ExtractPhoneNumber();
                    var range             = result.range;
                    var number            = result.result;
                    if (number != null)
                    {
                        var boundingBox = candidate.GetBoundingBox(range, out NSError boundingBoxError);
                        if (boundingBoxError == null)
                        {
                            var box = boundingBox.BoundingBox;
                            numbers.Add(number);
                            greenBoxes.Add(box);
                            //numberIsString = !(range.Location == candidate.GetLowerBound (0) && range.Length == candidate.GetUpperBound (0) - candidate.GetLowerBound (0));
                        }
                        else
                        {
                            boundingBoxError.Dispose();
                        }
                    }
                    if (numberIsSubstring)
                    {
                        redBoxes.Add(visionResult.BoundingBox);
                    }
                }
            }

            NumberTracker.LogFrame(numbers.ToArray());

            (CGColor color, CGRect [] boxes) [] boxGroups = { (UIColor.Red.CGColor, redBoxes.ToArray()), (UIColor.Green.CGColor, greenBoxes.ToArray()) };
Beispiel #13
0
        /// <summary>
        /// Asynchronously called by the Vision subsystem subsequent to `Perform` in `OnFrameCaptured`
        /// </summary>
        /// <param name="request">The request sent to the Vision subsystem.</param>
        /// <param name="err">If not null, describes an error in Vision.</param>
        private void RectanglesDetected(VNRequest request, NSError err)
        {
            if (err != null)
            {
                overlay.Message = err.ToString();
                Console.Error.WriteLine(err);
                return;
            }
            overlay.Clear();

            observations        = request.GetResults <VNRectangleObservation>();
            overlay.StrokeColor = UIColor.Blue.CGColor;

            //Draw all detected rectangles in blue
            foreach (var o in observations)
            {
                var quad = new[] { o.TopLeft, o.TopRight, o.BottomRight, o.BottomLeft };
                RectangleDetected(quad);
            }
        }
Beispiel #14
0
        void HandleClassification(VNRequest request, NSError error)
        {
            try
            {
                var observations = request.GetResults <VNClassificationObservation>();

                var best = observations[0]; // first/best classification result

                DispatchQueue.MainQueue.DispatchAsync(() =>
                {
                    var alert = UIAlertController.Create($"We think it's the castle in {best.Identifier}",
                                                         $"We are { best.Confidence * 100f:#.00}% confident",
                                                         UIAlertControllerStyle.Alert);
                    alert.AddAction(UIAlertAction.Create("Thanks!", UIAlertActionStyle.Default, (obj) => { }));
                    PresentViewController(alert, true, null);
                });
            }
            catch (Exception ex)
            {
                //¯\_(ツ)_/¯
            }
        }
        private void HandleClassification(VNRequest request, NSError error)
        {
            var observations = request.GetResults <VNClassificationObservation>();

            if (observations == null)
            {
                ShowAlert("Processing Error", "Unexpected result type from VNCoreMLRequest.");
                return;
            }
            if (observations.Length < 1)
            {
                DispatchQueue.MainQueue.DispatchAsync(() => {
                    ClassificationLabel.Text = "Can't Get Best Result";
                });
                return;
            }
            var best = observations[0];

            DispatchQueue.MainQueue.DispatchAsync(() => {
                ClassificationLabel.Text = $"Classification: {best.Identifier} Confidence: {best.Confidence * 100f:#.00}%";
            });
        }
Beispiel #16
0
        /// <summary>
        /// Asynchronously called by the Vision subsystem subsequent to `Perform` in `OnFrameCaptured`
        /// </summary>
        /// <param name="request">The request sent to the Vision subsystem.</param>
        /// <param name="err">If not null, describes an error in Vision.</param>
        private void ObjectTracked(VNRequest request, NSError err)
        {
            if (err != null)
            {
                Console.Error.WriteLine(err);
                InvokeOnMainThread(() => overlay.Message = err.ToString());
                return;
            }

            InvokeOnMainThread(() =>
            {
                overlay.Clear();
                overlay.StrokeColor = UIColor.Green.CGColor;
                var observations    = request.GetResults <VNDetectedObjectObservation>();
                var o = observations.FirstOrDefault();
                if (o != null)
                {
                    // o is a succesfully tracked object, so draw it on the `overlay`
                    overlay.Message = "Locked";
                    if (o.Confidence < 0.5)
                    {
                        overlay.StrokeColor = UIColor.Red.CGColor;
                    }
                    if (o.Confidence < 0.8)
                    {
                        overlay.StrokeColor = UIColor.Yellow.CGColor;
                    }

                    var quad = new[] {
                        new CGPoint(o.BoundingBox.Left, o.BoundingBox.Top),
                        new CGPoint(o.BoundingBox.Right, o.BoundingBox.Top),
                        new CGPoint(o.BoundingBox.Right, o.BoundingBox.Bottom),
                        new CGPoint(o.BoundingBox.Left, o.BoundingBox.Bottom)
                    };
                    ObjectTracked(quad);
                    trackedRectangle = o;
                }
            });
        }
        private void HandleRectangles(VNRequest request, NSError error)
        {
            var observations = request.GetResults <VNRectangleObservation>();

            if (observations == null)
            {
                ShowAlert("Processing Error", "Unexpected result type from VNDetectRectanglesRequest.");
                return;
            }
            if (observations.Length < 1)
            {
                DispatchQueue.MainQueue.DispatchAsync(() => {
                    ClassificationLabel.Text = "No rectangles detected.";
                });
                return;
            }
            var detectedRectangle = observations[0];
            var imageSize         = InputImage.Extent.Size;

            // Verify detected rectangle is valid.
            var boundingBox = detectedRectangle.BoundingBox.Scaled(imageSize);

            if (!InputImage.Extent.Contains(boundingBox))
            {
                DispatchQueue.MainQueue.DispatchAsync(() => {
                    ClassificationLabel.Text = "Invalid rectangle detected.";
                });
                return;
            }

            // Rectify the detected image and reduce it to inverted grayscale for applying model.
            var topLeft     = detectedRectangle.TopLeft.Scaled(imageSize);
            var topRight    = detectedRectangle.TopRight.Scaled(imageSize);
            var bottomLeft  = detectedRectangle.BottomLeft.Scaled(imageSize);
            var bottomRight = detectedRectangle.BottomRight.Scaled(imageSize);

            var correctedImage = InputImage.ImageByCroppingToRect(boundingBox);

            var fp1 = new Dictionary <string, CGPoint>()
            {
                { "inputTopLeft", topLeft },
                { "inputTopRight", topRight },
                { "inputBottomLeft", bottomLeft },
                { "inputBottomRight", bottomRight }
            };

            correctedImage = correctedImage.CreateByFiltering("CIPerspectiveCorrection", fp1.ToNSDictionary());

            var fp2 = new Dictionary <NSString, NSNumber>()
            {
                { CIFilterInputKey.Saturation, new NSNumber(0) },
                { CIFilterInputKey.Contrast, new NSNumber(32) }
            };

            correctedImage = correctedImage.CreateByFiltering("CIColorControls", fp2.ToNSDictionary());

            var fp3 = new Dictionary <NSString, NSNumber>();

            correctedImage = correctedImage.CreateByFiltering("CIColorInvert", fp3.ToNSDictionary());

            // Show the pre-processed image
            DispatchQueue.MainQueue.DispatchAsync(() =>
            {
                ClassificationLabel.Text = "Selected First Rectangle";
                CorrectedImageView.Image = new UIImage(correctedImage);
            });

            // Run the Core ML MNIST classifier -- results in handleClassification method
            var handler = new VNImageRequestHandler(correctedImage, new VNImageOptions());

            DispatchQueue.DefaultGlobalQueue.DispatchAsync(() => {
                NSError err;
                handler.Perform(new VNRequest[] { ClassificationRequest }, out err);
            });
        }
Beispiel #18
0
        void HandleClassificationRequest(VNRequest request, NSError error)
        {
            var observations = request.GetResults <VNClassificationObservation>();
            var best         = observations?[0];

            outputLabel.Text = $"{best.Identifier.Trim()}, {best.Confidence:P0}";

            activityIndication.StopAnimating();

            var saveFoodDish = best.Identifier.Trim();

            recipeFoodDish = best.Identifier.Trim();

            if (saveFoodDish == "Deviled Eggs")
            {
                // Create Alert
                var okCancelAlertController = UIAlertController.Create("Food Dish Photo", "Is " + saveFoodDish + " correct?", UIAlertControllerStyle.Alert);

                // Add Actions
                okCancelAlertController.AddAction(UIAlertAction.Create("Yes", UIAlertActionStyle.Default, alert => { AlertYesTapped(); }));

                okCancelAlertController.AddAction(UIAlertAction.Create("No", UIAlertActionStyle.Cancel, alert => { AlertNoTapped(); }));

                // Present Alert
                PresentViewController(okCancelAlertController, true, null);
            }
            if (saveFoodDish == "Tacos")
            {
                // Create Alert
                var okCancelAlertController = UIAlertController.Create("Food Dish Photo", "Is " + saveFoodDish + " correct?", UIAlertControllerStyle.Alert);

                // Add Actions
                okCancelAlertController.AddAction(UIAlertAction.Create("Yes", UIAlertActionStyle.Default, alert => { AlertYesTapped(); }));

                okCancelAlertController.AddAction(UIAlertAction.Create("No", UIAlertActionStyle.Cancel, alert => { AlertNoTapped(); }));

                // Present Alert
                PresentViewController(okCancelAlertController, true, null);
            }
            if (saveFoodDish == "Apple Pie")
            {
                // Create Alert
                var okCancelAlertController = UIAlertController.Create("Food Dish Photo", "Is " + saveFoodDish + " correct?", UIAlertControllerStyle.Alert);

                // Add Actions
                okCancelAlertController.AddAction(UIAlertAction.Create("Yes", UIAlertActionStyle.Default, alert => { AlertYesTapped(); }));

                okCancelAlertController.AddAction(UIAlertAction.Create("No", UIAlertActionStyle.Cancel, alert => { AlertNoTapped(); }));

                // Present Alert
                PresentViewController(okCancelAlertController, true, null);
            }
            if (saveFoodDish == "Baby Back Ribs")
            {
                // Create Alert
                var okCancelAlertController = UIAlertController.Create("Food Dish Photo", "Is " + saveFoodDish + " correct?", UIAlertControllerStyle.Alert);

                // Add Actions
                okCancelAlertController.AddAction(UIAlertAction.Create("Yes", UIAlertActionStyle.Default, alert => { AlertYesTapped(); }));

                okCancelAlertController.AddAction(UIAlertAction.Create("No", UIAlertActionStyle.Cancel, alert => { AlertNoTapped(); }));

                // Present Alert
                PresentViewController(okCancelAlertController, true, null);
            }
            if (saveFoodDish == "Clam Chowder")
            {
                // Create Alert
                var okCancelAlertController = UIAlertController.Create("Food Dish Photo", "Is " + saveFoodDish + " correct?", UIAlertControllerStyle.Alert);

                // Add Actions
                okCancelAlertController.AddAction(UIAlertAction.Create("Yes", UIAlertActionStyle.Default, alert => { AlertYesTapped(); }));

                okCancelAlertController.AddAction(UIAlertAction.Create("No", UIAlertActionStyle.Cancel, alert => { AlertNoTapped(); }));

                // Present Alert
                PresentViewController(okCancelAlertController, true, null);
            }
            if (saveFoodDish == "Eggs Benedict")
            {
                // Create Alert
                var okCancelAlertController = UIAlertController.Create("Food Dish Photo", "Is " + saveFoodDish + " correct?", UIAlertControllerStyle.Alert);

                // Add Actions
                okCancelAlertController.AddAction(UIAlertAction.Create("Yes", UIAlertActionStyle.Default, alert => { AlertYesTapped(); }));

                okCancelAlertController.AddAction(UIAlertAction.Create("No", UIAlertActionStyle.Cancel, alert => { AlertNoTapped(); }));

                // Present Alert
                PresentViewController(okCancelAlertController, true, null);
            }
            if (saveFoodDish == "Filet Mignon")
            {
                // Create Alert
                var okCancelAlertController = UIAlertController.Create("Food Dish Photo", "Is " + saveFoodDish + " correct?", UIAlertControllerStyle.Alert);

                // Add Actions
                okCancelAlertController.AddAction(UIAlertAction.Create("Yes", UIAlertActionStyle.Default, alert => { AlertYesTapped(); }));

                okCancelAlertController.AddAction(UIAlertAction.Create("No", UIAlertActionStyle.Cancel, alert => { AlertNoTapped(); }));

                // Present Alert
                PresentViewController(okCancelAlertController, true, null);
            }
            if (saveFoodDish == "Grilled Cheese Sandwich")
            {
                // Create Alert
                var okCancelAlertController = UIAlertController.Create("Food Dish Photo", "Is " + saveFoodDish + " correct?", UIAlertControllerStyle.Alert);

                // Add Actions
                okCancelAlertController.AddAction(UIAlertAction.Create("Yes", UIAlertActionStyle.Default, alert => { AlertYesTapped(); }));

                okCancelAlertController.AddAction(UIAlertAction.Create("No", UIAlertActionStyle.Cancel, alert => { AlertNoTapped(); }));

                // Present Alert
                PresentViewController(okCancelAlertController, true, null);
            }
            if (saveFoodDish == "Hamburger")
            {
                // Create Alert
                var okCancelAlertController = UIAlertController.Create("Food Dish Photo", "Is " + saveFoodDish + " correct?", UIAlertControllerStyle.Alert);

                // Add Actions
                okCancelAlertController.AddAction(UIAlertAction.Create("Yes", UIAlertActionStyle.Default, alert => { AlertYesTapped(); }));

                okCancelAlertController.AddAction(UIAlertAction.Create("No", UIAlertActionStyle.Cancel, alert => { AlertNoTapped(); }));

                // Present Alert
                PresentViewController(okCancelAlertController, true, null);
            }
            if (saveFoodDish == "Lobster Bisque")
            {
                // Create Alert
                var okCancelAlertController = UIAlertController.Create("Food Dish Photo", "Is " + saveFoodDish + " correct?", UIAlertControllerStyle.Alert);

                // Add Actions
                okCancelAlertController.AddAction(UIAlertAction.Create("Yes", UIAlertActionStyle.Default, alert => { AlertYesTapped(); }));

                okCancelAlertController.AddAction(UIAlertAction.Create("No", UIAlertActionStyle.Cancel, alert => { AlertNoTapped(); }));

                // Present Alert
                PresentViewController(okCancelAlertController, true, null);
            }
            if (saveFoodDish == "Macaroni and Cheese")
            {
                // Create Alert
                var okCancelAlertController = UIAlertController.Create("Food Dish Photo", "Is " + saveFoodDish + " correct?", UIAlertControllerStyle.Alert);

                // Add Actions
                okCancelAlertController.AddAction(UIAlertAction.Create("Yes", UIAlertActionStyle.Default, alert => { AlertYesTapped(); }));

                okCancelAlertController.AddAction(UIAlertAction.Create("No", UIAlertActionStyle.Cancel, alert => { AlertNoTapped(); }));

                // Present Alert
                PresentViewController(okCancelAlertController, true, null);
            }
            if (saveFoodDish == "Nachos")
            {
                // Create Alert
                var okCancelAlertController = UIAlertController.Create("Food Dish Photo", "Is " + saveFoodDish + " correct?", UIAlertControllerStyle.Alert);

                // Add Actions
                okCancelAlertController.AddAction(UIAlertAction.Create("Yes", UIAlertActionStyle.Default, alert => { AlertYesTapped(); }));

                okCancelAlertController.AddAction(UIAlertAction.Create("No", UIAlertActionStyle.Cancel, alert => { AlertNoTapped(); }));

                // Present Alert
                PresentViewController(okCancelAlertController, true, null);
            }
            if (saveFoodDish == "Omelette")
            {
                // Create Alert
                var okCancelAlertController = UIAlertController.Create("Food Photo", "Is " + saveFoodDish + " correct?", UIAlertControllerStyle.Alert);

                // Add Actions
                okCancelAlertController.AddAction(UIAlertAction.Create("Yes", UIAlertActionStyle.Default, alert => { AlertYesTapped(); }));

                okCancelAlertController.AddAction(UIAlertAction.Create("No", UIAlertActionStyle.Cancel, alert => { AlertNoTapped(); }));

                // Present Alert
                PresentViewController(okCancelAlertController, true, null);
            }
            if (saveFoodDish == "Pancakes")
            {
                // Create Alert
                var okCancelAlertController = UIAlertController.Create("Food Dish Photo", "Is " + saveFoodDish + " correct?", UIAlertControllerStyle.Alert);

                // Add Actions
                okCancelAlertController.AddAction(UIAlertAction.Create("Yes", UIAlertActionStyle.Default, alert => { AlertYesTapped(); }));

                okCancelAlertController.AddAction(UIAlertAction.Create("No", UIAlertActionStyle.Cancel, alert => { AlertNoTapped(); }));

                // Present Alert
                PresentViewController(okCancelAlertController, true, null);
            }
            if (saveFoodDish == "Ravioli")
            {
                // Create Alert
                var okCancelAlertController = UIAlertController.Create("Food Dish Photo", "Is " + saveFoodDish + " correct?", UIAlertControllerStyle.Alert);

                // Add Actions
                okCancelAlertController.AddAction(UIAlertAction.Create("Yes", UIAlertActionStyle.Default, alert => { AlertYesTapped(); }));

                okCancelAlertController.AddAction(UIAlertAction.Create("No", UIAlertActionStyle.Cancel, alert => { AlertNoTapped(); }));

                // Present Alert
                PresentViewController(okCancelAlertController, true, null);
            }
            if (saveFoodDish == "Strawberry Shortcake")
            {
                // Create Alert
                var okCancelAlertController = UIAlertController.Create("Food Dish Photo", "Is " + saveFoodDish + " correct?", UIAlertControllerStyle.Alert);

                // Add Actions
                okCancelAlertController.AddAction(UIAlertAction.Create("Yes", UIAlertActionStyle.Default, alert => { AlertYesTapped(); }));

                okCancelAlertController.AddAction(UIAlertAction.Create("No", UIAlertActionStyle.Cancel, alert => { AlertNoTapped(); }));

                // Present Alert
                PresentViewController(okCancelAlertController, true, null);
            }
            if (saveFoodDish == "Waffles")
            {
                // Create Alert
                var okCancelAlertController = UIAlertController.Create("Food Dish Photo", "Is " + saveFoodDish + " correct?", UIAlertControllerStyle.Alert);

                // Add Actions
                okCancelAlertController.AddAction(UIAlertAction.Create("Yes", UIAlertActionStyle.Default, alert => { AlertYesTapped(); }));

                okCancelAlertController.AddAction(UIAlertAction.Create("No", UIAlertActionStyle.Cancel, alert => { AlertNoTapped(); }));

                // Present Alert
                PresentViewController(okCancelAlertController, true, null);
            }
            if (saveFoodDish == "Caesar Salad")
            {
                // Create Alert
                var okCancelAlertController = UIAlertController.Create("Food Dish Photo", "Is " + saveFoodDish + " correct?", UIAlertControllerStyle.Alert);

                // Add Actions
                okCancelAlertController.AddAction(UIAlertAction.Create("Yes", UIAlertActionStyle.Default, alert => { AlertYesTapped(); }));

                okCancelAlertController.AddAction(UIAlertAction.Create("No", UIAlertActionStyle.Cancel, alert => { AlertNoTapped(); }));

                // Present Alert
                PresentViewController(okCancelAlertController, true, null);
            }
            if (saveFoodDish == "Cheesecake")
            {
                // Create Alert
                var okCancelAlertController = UIAlertController.Create("Food Dish Photo", "Is " + saveFoodDish + " correct?", UIAlertControllerStyle.Alert);

                // Add Actions
                okCancelAlertController.AddAction(UIAlertAction.Create("Yes", UIAlertActionStyle.Default, alert => { AlertYesTapped(); }));

                okCancelAlertController.AddAction(UIAlertAction.Create("No", UIAlertActionStyle.Cancel, alert => { AlertNoTapped(); }));

                // Present Alert
                PresentViewController(okCancelAlertController, true, null);
            }
            if (saveFoodDish == "Donuts")
            {
                // Create Alert
                var okCancelAlertController = UIAlertController.Create("Food Dish Photo", "Is " + saveFoodDish + " correct?", UIAlertControllerStyle.Alert);

                // Add Actions
                okCancelAlertController.AddAction(UIAlertAction.Create("Yes", UIAlertActionStyle.Default, alert => { AlertYesTapped(); }));

                okCancelAlertController.AddAction(UIAlertAction.Create("No", UIAlertActionStyle.Cancel, alert => { AlertNoTapped(); }));

                // Present Alert
                PresentViewController(okCancelAlertController, true, null);
            }
            if (saveFoodDish == "Club Sandwich")
            {
                // Create Alert
                var okCancelAlertController = UIAlertController.Create("Food Dish Photo", "Is " + saveFoodDish + " correct?", UIAlertControllerStyle.Alert);

                // Add Actions
                okCancelAlertController.AddAction(UIAlertAction.Create("Yes", UIAlertActionStyle.Default, alert => { AlertYesTapped(); }));

                okCancelAlertController.AddAction(UIAlertAction.Create("No", UIAlertActionStyle.Cancel, alert => { AlertNoTapped(); }));

                // Present Alert
                PresentViewController(okCancelAlertController, true, null);
            }
            if (saveFoodDish == "Escargots")
            {
                // Create Alert
                var okCancelAlertController = UIAlertController.Create("Food Dish Photo", "Is " + saveFoodDish + " correct?", UIAlertControllerStyle.Alert);

                // Add Actions
                okCancelAlertController.AddAction(UIAlertAction.Create("Yes", UIAlertActionStyle.Default, alert => { AlertYesTapped(); }));

                okCancelAlertController.AddAction(UIAlertAction.Create("No", UIAlertActionStyle.Cancel, alert => { AlertNoTapped(); }));

                // Present Alert
                PresentViewController(okCancelAlertController, true, null);
            }
            if (saveFoodDish == "Fish and Chips")
            {
                // Create Alert
                var okCancelAlertController = UIAlertController.Create("Food Dish Photo", "Is " + saveFoodDish + " correct?", UIAlertControllerStyle.Alert);

                // Add Actions
                okCancelAlertController.AddAction(UIAlertAction.Create("Yes", UIAlertActionStyle.Default, alert => { AlertYesTapped(); }));

                okCancelAlertController.AddAction(UIAlertAction.Create("No", UIAlertActionStyle.Cancel, alert => { AlertNoTapped(); }));

                // Present Alert
                PresentViewController(okCancelAlertController, true, null);
            }
            if (saveFoodDish == "Frozen Yogurt")
            {
                // Create Alert
                var okCancelAlertController = UIAlertController.Create("Food Dish Photo", "Is " + saveFoodDish + " correct?", UIAlertControllerStyle.Alert);

                // Add Actions
                okCancelAlertController.AddAction(UIAlertAction.Create("Yes", UIAlertActionStyle.Default, alert => { AlertYesTapped(); }));

                okCancelAlertController.AddAction(UIAlertAction.Create("No", UIAlertActionStyle.Cancel, alert => { AlertNoTapped(); }));

                // Present Alert
                PresentViewController(okCancelAlertController, true, null);
            }
            if (saveFoodDish == "Huevos Rancheros")
            {
                // Create Alert
                var okCancelAlertController = UIAlertController.Create("Food Dish Photo", "Is " + saveFoodDish + " correct?", UIAlertControllerStyle.Alert);

                // Add Actions
                okCancelAlertController.AddAction(UIAlertAction.Create("Yes", UIAlertActionStyle.Default, alert => { AlertYesTapped(); }));

                okCancelAlertController.AddAction(UIAlertAction.Create("No", UIAlertActionStyle.Cancel, alert => { AlertNoTapped(); }));

                // Present Alert
                PresentViewController(okCancelAlertController, true, null);
            }
            if (saveFoodDish == "Ice Cream")
            {
                // Create Alert
                var okCancelAlertController = UIAlertController.Create("Food Dish Photo", "Is " + saveFoodDish + " correct?", UIAlertControllerStyle.Alert);

                // Add Actions
                okCancelAlertController.AddAction(UIAlertAction.Create("Yes", UIAlertActionStyle.Default, alert => { AlertYesTapped(); }));

                okCancelAlertController.AddAction(UIAlertAction.Create("No", UIAlertActionStyle.Cancel, alert => { AlertNoTapped(); }));

                // Present Alert
                PresentViewController(okCancelAlertController, true, null);
            }
            if (saveFoodDish == "Lasagna")
            {
                // Create Alert
                var okCancelAlertController = UIAlertController.Create("Food Dish Photo", "Is " + saveFoodDish + " correct?", UIAlertControllerStyle.Alert);

                // Add Actions
                okCancelAlertController.AddAction(UIAlertAction.Create("Yes", UIAlertActionStyle.Default, alert => { AlertYesTapped(); }));

                okCancelAlertController.AddAction(UIAlertAction.Create("No", UIAlertActionStyle.Cancel, alert => { AlertNoTapped(); }));

                // Present Alert
                PresentViewController(okCancelAlertController, true, null);
            }
            if (saveFoodDish == "Pizza")
            {
                // Create Alert
                var okCancelAlertController = UIAlertController.Create("Food Dish Photo", "Is " + saveFoodDish + " correct?", UIAlertControllerStyle.Alert);

                // Add Actions
                okCancelAlertController.AddAction(UIAlertAction.Create("Yes", UIAlertActionStyle.Default, alert => { AlertYesTapped(); }));

                okCancelAlertController.AddAction(UIAlertAction.Create("No", UIAlertActionStyle.Cancel, alert => { AlertNoTapped(); }));

                // Present Alert
                PresentViewController(okCancelAlertController, true, null);
            }
            if (saveFoodDish == "Spaghetti Bolognese")
            {
                // Create Alert
                var okCancelAlertController = UIAlertController.Create("Food Dish Photo", "Is " + saveFoodDish + " correct?", UIAlertControllerStyle.Alert);

                // Add Actions
                okCancelAlertController.AddAction(UIAlertAction.Create("Yes", UIAlertActionStyle.Default, alert => { AlertYesTapped(); }));

                okCancelAlertController.AddAction(UIAlertAction.Create("No", UIAlertActionStyle.Cancel, alert => { AlertNoTapped(); }));

                // Present Alert
                PresentViewController(okCancelAlertController, true, null);
            }
            if (saveFoodDish == "Takoyaki")
            {
                // Create Alert
                var okCancelAlertController = UIAlertController.Create("Food Dish Photo", "Is " + saveFoodDish + " correct?", UIAlertControllerStyle.Alert);

                // Add Actions
                okCancelAlertController.AddAction(UIAlertAction.Create("Yes", UIAlertActionStyle.Default, alert => { AlertYesTapped(); }));

                okCancelAlertController.AddAction(UIAlertAction.Create("No", UIAlertActionStyle.Cancel, alert => { AlertNoTapped(); }));

                // Present Alert
                PresentViewController(okCancelAlertController, true, null);
            }
            if (saveFoodDish == "Scallops")
            {
                // Create Alert
                var okCancelAlertController = UIAlertController.Create("Food Dish Photo", "Is " + saveFoodDish + " correct?", UIAlertControllerStyle.Alert);

                // Add Actions
                okCancelAlertController.AddAction(UIAlertAction.Create("Yes", UIAlertActionStyle.Default, alert => { AlertYesTapped(); }));

                okCancelAlertController.AddAction(UIAlertAction.Create("No", UIAlertActionStyle.Cancel, alert => { AlertNoTapped(); }));

                // Present Alert
                PresentViewController(okCancelAlertController, true, null);
            }
            if (saveFoodDish == "Bruschetta")
            {
                // Create Alert
                var okCancelAlertController = UIAlertController.Create("Food Dish Photo", "Is " + saveFoodDish + " correct?", UIAlertControllerStyle.Alert);

                // Add Actions
                okCancelAlertController.AddAction(UIAlertAction.Create("Yes", UIAlertActionStyle.Default, alert => { AlertYesTapped(); }));

                okCancelAlertController.AddAction(UIAlertAction.Create("No", UIAlertActionStyle.Cancel, alert => { AlertNoTapped(); }));

                // Present Alert
                PresentViewController(okCancelAlertController, true, null);
            }
            if (saveFoodDish == "Carrot Cake")
            {
                // Create Alert
                var okCancelAlertController = UIAlertController.Create("Food Dish Photo", "Is " + saveFoodDish + " correct?", UIAlertControllerStyle.Alert);

                // Add Actions
                okCancelAlertController.AddAction(UIAlertAction.Create("Yes", UIAlertActionStyle.Default, alert => { AlertYesTapped(); }));

                okCancelAlertController.AddAction(UIAlertAction.Create("No", UIAlertActionStyle.Cancel, alert => { AlertNoTapped(); }));

                // Present Alert
                PresentViewController(okCancelAlertController, true, null);
            }
            if (saveFoodDish == "French Fries")
            {
                // Create Alert
                var okCancelAlertController = UIAlertController.Create("Food Dish Photo", "Is " + saveFoodDish + " correct?", UIAlertControllerStyle.Alert);

                // Add Actions
                okCancelAlertController.AddAction(UIAlertAction.Create("Yes", UIAlertActionStyle.Default, alert => { AlertYesTapped(); }));

                okCancelAlertController.AddAction(UIAlertAction.Create("No", UIAlertActionStyle.Cancel, alert => { AlertNoTapped(); }));

                // Present Alert
                PresentViewController(okCancelAlertController, true, null);
            }
            if (saveFoodDish == "Fried Calamari")
            {
                // Create Alert
                var okCancelAlertController = UIAlertController.Create("Food Dish Photo", "Is " + saveFoodDish + " correct?", UIAlertControllerStyle.Alert);

                // Add Actions
                okCancelAlertController.AddAction(UIAlertAction.Create("Yes", UIAlertActionStyle.Default, alert => { AlertYesTapped(); }));

                okCancelAlertController.AddAction(UIAlertAction.Create("No", UIAlertActionStyle.Cancel, alert => { AlertNoTapped(); }));

                // Present Alert
                PresentViewController(okCancelAlertController, true, null);
            }
            if (saveFoodDish == "Peking Duck")
            {
                // Create Alert
                var okCancelAlertController = UIAlertController.Create("Food Dish Photo", "Is " + saveFoodDish + " correct?", UIAlertControllerStyle.Alert);

                // Add Actions
                okCancelAlertController.AddAction(UIAlertAction.Create("Yes", UIAlertActionStyle.Default, alert => { AlertYesTapped(); }));

                okCancelAlertController.AddAction(UIAlertAction.Create("No", UIAlertActionStyle.Cancel, alert => { AlertNoTapped(); }));

                // Present Alert
                PresentViewController(okCancelAlertController, true, null);
            }
            if (saveFoodDish == "Red Velvet Cake")
            {
                // Create Alert
                var okCancelAlertController = UIAlertController.Create("Food Dish Photo", "Is " + saveFoodDish + " correct?", UIAlertControllerStyle.Alert);

                // Add Actions
                okCancelAlertController.AddAction(UIAlertAction.Create("Yes", UIAlertActionStyle.Default, alert => { AlertYesTapped(); }));

                okCancelAlertController.AddAction(UIAlertAction.Create("No", UIAlertActionStyle.Cancel, alert => { AlertNoTapped(); }));

                // Present Alert
                PresentViewController(okCancelAlertController, true, null);
            }
            if (saveFoodDish == "Sushi")
            {
                // Create Alert
                var okCancelAlertController = UIAlertController.Create("Food Dish Photo", "Is " + saveFoodDish + " correct?", UIAlertControllerStyle.Alert);

                // Add Actions
                okCancelAlertController.AddAction(UIAlertAction.Create("Yes", UIAlertActionStyle.Default, alert => { AlertYesTapped(); }));

                okCancelAlertController.AddAction(UIAlertAction.Create("No", UIAlertActionStyle.Cancel, alert => { AlertNoTapped(); }));

                // Present Alert
                PresentViewController(okCancelAlertController, true, null);
            }
            if (saveFoodDish == "Steak")
            {
                // Create Alert
                var okCancelAlertController = UIAlertController.Create("Food Dish Photo", "Is " + saveFoodDish + " correct?", UIAlertControllerStyle.Alert);

                // Add Actions
                okCancelAlertController.AddAction(UIAlertAction.Create("Yes", UIAlertActionStyle.Default, alert => { AlertYesTapped(); }));

                okCancelAlertController.AddAction(UIAlertAction.Create("No", UIAlertActionStyle.Cancel, alert => { AlertNoTapped(); }));

                // Present Alert
                PresentViewController(okCancelAlertController, true, null);
            }
            if (saveFoodDish == "Chocolate Mousse")
            {
                // Create Alert
                var okCancelAlertController = UIAlertController.Create("Food Dish Photo", "Is " + saveFoodDish + " correct?", UIAlertControllerStyle.Alert);

                // Add Actions
                okCancelAlertController.AddAction(UIAlertAction.Create("Yes", UIAlertActionStyle.Default, alert => { AlertYesTapped(); }));

                okCancelAlertController.AddAction(UIAlertAction.Create("No", UIAlertActionStyle.Cancel, alert => { AlertNoTapped(); }));

                // Present Alert
                PresentViewController(okCancelAlertController, true, null);
            }
        }