#WinML – #CustomVision, object recognition using Onnx in Windows10, calculate FPS

Hi !

Quick post today. And it’s mostly as a brain reminder on the best way to perform a Frames Per Second calculation when we are analyzing images using a ONNX model. In the final UWP app, I added a top right label displaying the current date and time, and the processed FPS

01 custom vision uwp frame analysis using onnx fps

And the code behind all this is very simple, specially line 10

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

view raw


hosted with ❤ by GitHub

So, I’ll search for my sample next time I need to display this.

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

Happy Coding!

Greetings @ Burlington

El Bruno


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 )

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: