/// <summary> /// Make a prediction using the standard interface /// </summary> /// <param name="input">an instance of ObjectDetectorInput to predict from</param> /// <param name="error">If an error occurs, upon return contains an NSError object that describes the problem.</param> public ObjectDetectorOutput GetPrediction(ObjectDetectorInput input, out NSError error) { var prediction = model.GetPrediction(input, out error); if (prediction == null) { return(null); } var confidenceValue = prediction.GetFeatureValue("confidence").MultiArrayValue; var coordinatesValue = prediction.GetFeatureValue("coordinates").MultiArrayValue; return(new ObjectDetectorOutput(confidenceValue, coordinatesValue)); }
/// <summary> /// Make a prediction using the convenience interface /// </summary> /// <param name="image">Input image as color (kCVPixelFormatType_32RGBA) image buffer, 416 pizels wide by 416 pixels high</param> /// <param name="iouThreshold">(optional) IOU Threshold override (default: 0.45) as double</param> /// <param name="confidenceThreshold">(optional) Confidence Threshold override (default: 0.25) as double</param> /// <param name="error">If an error occurs, upon return contains an NSError object that describes the problem.</param> public ObjectDetectorOutput GetPrediction(CVPixelBuffer image, double iouThreshold, double confidenceThreshold, out NSError error) { var input = new ObjectDetectorInput(image, iouThreshold, confidenceThreshold); return(GetPrediction(input, out error)); }