Cognitive Toolkit Model Evaluation in UWP

GO TO ADMIN PANEL > ADD-ONS AND INSTALL VERTIFORO SIDEBAR TO SEE FORUMS AND SIDEBAR

Windows

Windows
Joined
Nov 9, 2015
Messages
2,489
Points
1
We are excited the share with you that Microsoft Cognitive Toolkit (CNTK) 2.1 has added support for model evaluation on UWP applications. This means you can harness the power of deep learning in your Windows apps delivered via the Windows Store! Read on to find out how can infuse your apps with the power of AI.

The Virtuous Intelligence Cycle


Cloud-connected devices can perform operations locally or delegate them to the cloud. The virtually unlimited compute power of the cloud makes it a good choice for running tasks that need significant compute power but don’t require low latency. In machine learning, model training is an example of such a task. It might require hours or days to train a model, but once the model is trained, deploying it closer to where the data is generated has some very useful properties. First, it reduces the roundtrip latency inherently unavoidable in cloud communication. This is critical for time-sensitive deep learning scenarios like self-driving cars and industrial equipment failure detection. Second, it can unlock insights from data that were previously discarded due to network transmission costs. And finally, it allows machine learning solutions in scenarios with intermittent network connectivity like search & rescue, agriculture and others.

We refer to devices with non-trivial compute power that are in closer proximity to the data source as “intelligent edge” devices. Intelligent edge devices can vary broadly depending on scenario as shown in the figure below.

Please, Log in or Register to view URLs content!


In the virtuous intelligence cycle, deep learning models trained in the cloud are deployed and evaluated at the edge. Additionally, the edge feeds valuable data back to the cloud where the models are improved and redeployed to the edge, hence completing the virtuous cycle.

The improvements described in this post allow UWP applications to be part of the intelligent edge where deep learning models can be evaluated.

Image Classification Example


Let’s look at an example where an image classification machine learning model is built into an UWP application. The app allows you to pick a CNTK compatible model to perform image classification on an image. Several pre-trained models to use for this purpose are available
Please, Log in or Register to view URLs content!
.

The code for the entire solution is
Please, Log in or Register to view URLs content!
.

Currently, only C++ CNTK UWP bindings are supported. However, the sample demonstrates how a C# based UWP solution can perform model evaluation by referencing a WinRT library that wraps the
Please, Log in or Register to view URLs content!
.

Please, Log in or Register to view URLs content!


packages.config specifies the NuGet packages the library uses, and points to the UWP-compatible package:



<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="CNTK.UWP.CPUOnly" version="2.1.0" targetFramework="native" />
</packages>



This NuGet package provides UWP-compatible CNTK components, including the OpenBLAS math library, for CPU-based model evaluation. ImageRecognizerLib exposes Create and RecognizeObjectAsync methods used to load the pre-trained CNTK model and classify the specified image input as an array of bytes.

The rest of the solution is a few simple XAML UI elements to accept input from the user. Here is a quick animation of the app in action:

Please, Log in or Register to view URLs content!


Now it’s your turn!


We’ve demonstrated how you can use the newly added UWP support in CNTK to bring the next level of intelligence to your Windows applications. We can’t wait to see the awesome apps you will build with this exciting new technology!

Please, Log in or Register to view URLs content!
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top