コード例 #1
0
        private async void LoadModel()
        {
            //Load a machine learning model
            StorageFile modelFile = await StorageFile.GetFileFromApplicationUriAsync(new Uri($"ms-appx:///Assets/model.onnx"));

            ModelGen = await Vgg19Model.CreateVgg19Model(modelFile).ConfigureAwait(false);
        }
コード例 #2
0
        public static async Task <Vgg19Model> CreateVgg19Model(StorageFile file)
        {
            LearningModelPreview learningModel = await LearningModelPreview.LoadModelFromStorageFileAsync(file);

            learningModel.InferencingOptions.PreferredDeviceKind = LearningModelDeviceKindPreview.LearningDeviceGpu;
            Vgg19Model model = new Vgg19Model();

            model.learningModel = learningModel;
            return(model);
        }