Пример #1
0
        /// <summary>
        /// Make a prediction using the standard interface
        /// </summary>
        /// <param name="input">an instance of CookHappyJuneInput to predict from</param>
        /// <param name="error">If an error occurs, upon return contains an NSError object that describes the problem.</param>
        public CookHappyJuneOutput GetPrediction(CookHappyJuneInput input, out NSError error)
        {
            if (input == null)
            {
                throw new ArgumentNullException(nameof(input));
            }

            var prediction = model.GetPrediction(input, out error);

            if (prediction == null)
            {
                return(null);
            }

            var lossValue       = prediction.GetFeatureValue("loss").DictionaryValue;
            var classLabelValue = prediction.GetFeatureValue("classLabel").StringValue;

            return(new CookHappyJuneOutput(lossValue, classLabelValue));
        }
Пример #2
0
        /// <summary>
        /// Make a prediction using the convenience interface
        /// </summary>
        /// <param name="data"> as color (kCVPixelFormatType_32BGRA) image buffer, 224 pizels wide by 224 pixels high</param>
        /// <param name="options">prediction options</param>
        /// <param name="error">If an error occurs, upon return contains an NSError object that describes the problem.</param>
        public CookHappyJuneOutput GetPrediction(CVPixelBuffer data, MLPredictionOptions options, out NSError error)
        {
            var input = new CookHappyJuneInput(data);

            return(GetPrediction(input, options, out error));
        }