/// <summary> /// Make a prediction using the standard interface /// </summary> /// <param name="input">an instance of ImageClassifierInput to predict from</param> /// <param name="error">If an error occurs, upon return contains an NSError object that describes the problem.</param> public ImageClassifierOutput GetPrediction(ImageClassifierInput input, out NSError error) { var prediction = model.GetPrediction(input, out error); if (prediction == null) { return(null); } var classLabelProbsValue = prediction.GetFeatureValue("classLabelProbs").DictionaryValue; var classLabelValue = prediction.GetFeatureValue("classLabel").StringValue; return(new ImageClassifierOutput(classLabelProbsValue, classLabelValue)); }
/// <summary> /// Make a prediction using the convenience interface /// </summary> /// <param name="image">Input image to be classified as color (kCVPixelFormatType_32BGRA) image buffer, 299 pizels wide by 299 pixels high</param> /// <param name="error">If an error occurs, upon return contains an NSError object that describes the problem.</param> public ImageClassifierOutput GetPrediction(CVPixelBuffer image, out NSError error) { var input = new ImageClassifierInput(image); return(GetPrediction(input, out error)); }