private async Task EvaluateVideoFrameAsync(VideoFrame frame) { if (frame != null) { try { MyCustomVisionModelInput inputData = new MyCustomVisionModelInput { Data = frame }; var output = await _model.EvaluateAsync(inputData); var product = output.ClassLabel.GetAsVectorView()[0]; var loss = output.Loss[0][product]; var message = string.Join(", ", product + " " + (loss * 100.0f).ToString("#0.00") + "%"); await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => StatusText.Text = message); Debug.WriteLine(message); _spiDisplay.WriteLinesToScreen(new List <string> { message }); } catch (Exception ex) { Debug.WriteLine($"error: {ex.Message}"); } } }
private async Task EvaluateVideoFrameAsync(VideoFrame frame) { if (frame != null) { try { MyCustomVisionModelInput inputData = new MyCustomVisionModelInput { Data = frame }; var output = await _model.EvaluateAsync(inputData); var product = output.ClassLabel.GetAsVectorView()[0]; var loss = output.Loss[0][product]; var message = string.Join(", ", product + " " + (loss * 100.0f).ToString("#0.00") + "%"); var percent = loss * 100.0f; if (product != "deer")//just for debug testing { string isDeer = "deer!"; } await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => StatusText.Text = message); Debug.WriteLine(message); // Insert Lines for SPI Display here } catch (Exception ex) { Debug.WriteLine($"error: {ex.Message}"); } } }