コード例 #1
0
ファイル: Computer.cs プロジェクト: marcominerva/AICompanion
        /// <summary>
        /// Make a prediction using the standard interface
        /// </summary>
        /// <param name="input">an instance of ComputerInput to predict from</param>
        /// <param name="error">If an error occurs, upon return contains an NSError object that describes the problem.</param>
        public ComputerOutput GetPrediction(ComputerInput input, out NSError error)
        {
            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 ComputerOutput(lossValue, classLabelValue));
        }
コード例 #2
0
ファイル: Computer.cs プロジェクト: marcominerva/AICompanion
        /// <summary>
        /// Make a prediction using the convenience interface
        /// </summary>
        /// <param name="data"> as color (kCVPixelFormatType_32BGRA) image buffer, 227 pizels wide by 227 pixels high</param>
        /// <param name="error">If an error occurs, upon return contains an NSError object that describes the problem.</param>
        public ComputerOutput GetPrediction(CVPixelBuffer data, out NSError error)
        {
            var input = new ComputerInput(data);

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