#WinML – #CustomVision, reconocimiento de objectos utilizando Onnx en Windows10, calculando FPS

Buenas !

Hoy va un post rápido. Y es del tipo de ayuda mental, ya que siempre que tengo que mostrar información relacionada a proceso de frames por segundo, tengo que buscar en mis aplicaciones anteriores.

En este caso agregare esta información al reconocimiento de imágenes con un modelo Onnx exportado desde Custom Vision. En la UWP app que he creado en post anteriores, mostrare un label con la fecha y hora, e información de FPS.

01 custom vision uwp frame analysis using onnx fps

El código es muy simple, especial detalle a la linea 10


private Stopwatch _stopwatch;
private async Task LoadAndEvaluateModelAsync(VideoFrame videoFrame)
{
_stopwatch = Stopwatch.StartNew();
_predictions = await _objectDetection.PredictImageAsync(videoFrame);
_stopwatch.Stop();
await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
{
var message = $"{DateTime.Now.ToLongTimeString()} – {1000f / _stopwatch.ElapsedMilliseconds,4:f1} fps";
TextBlockResults.Text = message; DrawFrames();
});
}

view raw

CVOnnxFps.cs

hosted with ❤ by GitHub

Brain Backup done!

The full app can be seen in https://github.com/elbruno/events/tree/master/2019%2001%2010%20CodeMash%20CustomVision/CSharp/CustomVisionMarvelConsole01

Happy Coding!

Saludos @ Burlington

El Bruno

References

My Posts

Windows 10 and YOLOV2 for Object Detection Series

Leave a comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: