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.
El código es muy simple, especial detalle a la linea 10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
}); | |
} |
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
- Custom Vision
- Quickstart: Create an image classification project with the Custom Vision .NET SDK
- Quickstart: Create an object detection project with the Custom Vision .NET SDK
- ONNX Documentation
- Sample application for ONNX1.2 models exported from Custom Vision Service
- Windows Community Toolkit
- Visual Studio Tools for AI
My Posts
- Object recognition with Custom Vision and ONNX in Windows applications using WinML (1)
- Object recognition with Custom Vision and ONNX in Windows applications using WinML (2)
- Object recognition with Custom Vision and ONNX in Windows applications using Windows ML, drawing frames (3)
Windows 10 and YOLOV2 for Object Detection Series
- Introduction to YoloV2 for object detection
- Create a basic Windows10 App and use YoloV2 in the camera for object detection
- Transform YoloV2 output analysis to C# classes and display them in frames
- Resize YoloV2 output to support multiple formats and process and display frames per second
- How to convert Tiny-YoloV3 model in CoreML format to ONNX and use it in a Windows 10 App
- Updated demo using Tiny YOLO V2 1.2, Windows 10 and YOLOV2 for Object Detection Series
- Alternatives to Yolo for object detection in ONNX format