public async Task <bool> LoadModel() { try { StorageFile imageRecoModelFile = await StorageFile.GetFileFromApplicationUriAsync(modelFile); if (imageRecoModelFile == null) { Debug.Log("Could not read model file"); return(false); } #if SDK_1809 model = await TinyYoloV2O12Model.CreateFromStreamAsync(imageRecoModelFile); #else model = await TinyYoloV2O1Model.CreateTinyYoloV2O1Model(imageRecoModelFile); #endif if (model == null) { Debug.Log("Could not instantiate model"); return(false); } } catch (Exception e) { Debug.Log($"Could not get file: {e.Message}"); throw; } return(true); }
public static async Task <TinyYoloV2O12Model> CreateFromStreamAsync(IRandomAccessStreamReference stream) { TinyYoloV2O12Model learningModel = new TinyYoloV2O12Model(); learningModel.model = await LearningModel.LoadFromStreamAsync(stream); learningModel.session = new LearningModelSession(learningModel.model); learningModel.binding = new LearningModelBinding(learningModel.session); return(learningModel); }