Exemplo n.º 1
0
        public static async Task <OnnxModel> CreateOnnxModel(StorageFile file)
        {
            LearningModelPreview learningModel = null;

            try
            {
                learningModel = await LearningModelPreview.LoadModelFromStorageFileAsync(file);
            }
            catch (Exception e)
            {
                var exceptionStr = e.ToString();
                System.Console.WriteLine(exceptionStr);
                throw e;
            }
            OnnxModel model = new OnnxModel();

            learningModel.InferencingOptions.PreferredDeviceKind          = LearningModelDeviceKindPreview.LearningDeviceAny;
            learningModel.InferencingOptions.ReclaimMemoryAfterEvaluation = true;

            model.learningModel = learningModel;
            return(model);
        }
Exemplo n.º 2
0
        public static async Task <OnnxModel> CreateOnnxModel()
        {
            var modelFile = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Assets//ModelsAI//model.onnx"));

            return(await OnnxModel.CreateOnnxModel(modelFile));
        }
Exemplo n.º 3
0
 public async Task Init()
 {
     onnxmodel = await OnnxModel.CreateOnnxModel();
 }