private async void PredictAll() { if (Frames == null || Frames.Count < 1) { return; } Status = new AppStatusInfo() { Status = Enums.Status.Working, StringStatus = $"Working | loading model..." }; if (_model == null) { _model = new NeuroModel(); } var isLoaded = await _model.Load(); if (!isLoaded) { Status = new AppStatusInfo() { Status = Enums.Status.Error, StringStatus = $"Error: unable to load model" }; _model.Dispose(); _model = null; return; } var index = 0; Status = new AppStatusInfo() { Status = Enums.Status.Working, StringStatus = $"Working | processing images: {index} / {Frames.Count}" }; foreach (var frame in Frames) { index++; frame.Rectangles = await _model.Predict(frame); if (index < Frames.Count) { Status = new AppStatusInfo() { Status = Enums.Status.Working, StringStatus = $"Working | processing images: {index} / {Frames.Count}" } } ; else { Status = new AppStatusInfo() { Status = Enums.Status.Ready }; } } UpdateUi(); }
private async void PredictAll() { if (Frames == null || Frames.Count < 1) { return; } Status = new AppStatusInfo() { Status = Enums.Status.Working, StringStatus = $"Working | loading model..." }; if (_model == null) { _model = new NeuroModel(); } var isLoaded = await _model.Run(); if (!isLoaded) { Status = new AppStatusInfo() { Status = Enums.Status.Error, StringStatus = $"Error: unable to load model" }; _model.Dispose(); _model = null; return; } var index = 0; Status = new AppStatusInfo() { Status = Enums.Status.Working, StringStatus = $"Working | processing images: {index} / {Frames.Count}" }; foreach (var frame in Frames) { index++; frame.Rectangles = await _model.Predict(frame); if (index < Frames.Count) { Status = new AppStatusInfo() { Status = Enums.Status.Working, StringStatus = $"Working | processing images: {index} / {Frames.Count}" } } ; if (frame.Rectangles.Count > 0) { frame.IsVisible = true; } } _frames = new List <Frame>(Frames); await _model.Stop(); SelectedIndex = 0; //Fix bug when application stopped if index > 0 UpdateUi(); Status = new AppStatusInfo() { Status = Enums.Status.Ready }; }