How to write machine learning apps for Windows 10

We’re not far away from a , and with it plenty of new APIs for your applications. One big change is as part of Windows applications, taking advantage of local GPUs to accelerate machine learning applications.

Building a machine learning application can be a complex process. Training a model can require a lot of data, and a considerable amount of processing power. That’s fine if you’ve got access to a cloud platform and lots of bandwidth, but what if you want to take an existing model from GitHub and run it on a PC?

Trained machine learning models are an ideal tool for bringing the benefits of neural networks and deep learning to your applications. All you should need to do is hook up the appropriate interfaces, and they should run as part of your code. But with many and platforms, there’s a need for a common runtime that can use any of the models out there. That’s where the new Windows machine learning tools comes into play, offering Windows developers a platform to run existing machine learning models in their applications, taking advantage of a developing open standard for exchanging machine learning models.

Introducing ONNX for Windows

Microsoft is supporting format, an open standard for sharing deep learning models between platforms and services. With ONNX you can build and train neural networks on cloud platforms or on dedicated machine learning systems, using well-known algorithms. Once trained, the algorithms can run on another framework, or with Windows machine learning as part of an application on a PC, or even an IoT device.

, the Python-based , and Microsoft’s own (formerly named CNTK). While there’s not direct support for Google’s , you can find unofficial connectors that let you export as ONNX, with an official import/export tool currently under development. ONNX offers its own runtimes and libraries, so your models can run on your hardware and take advantage of any accelerators you have.

Converting machine learning models with ONNX

If you’re using Microsoft Cognitive Toolkit on Azure to build and run machine learning models, you should already have access to ONNX, because it’s built into every version after 2.3.1, and it’ll soon be part of the . All you need to do to export a model is to choose ONNX as your export format, something you can do with a single line of Python or C# code. You don’t even need to write the export statement into your training application; it can even be a call from an Azure Notebook or a statement in an Azure machine learning pipeline.

Microsoft also provides its own tools to convert models from some other formats, like , to ONNX. Microsoft’s is a Python package, so you can use it with existing machine learning tools, like . By integrating with familiar machine learning development environments, you can mix cross-platform data science skills with Windows developers—using the same machine learning models that now run on popular mobile platforms, as well on Windows.

It’s not all plain sailing: There can be issues with working with Core ML models that deliver image outputs, because ONNX doesn’t directly support image types. However, Microsoft’s WinMLTools documentation walks you through the process of mapping an ONNX output tensor to a collection of image files.

Bringing machine learning out of the cloud is an important step; it removes latency from applications that need to respond quickly and reduces the amount of data sent from remote sites to cloud servers. With Windows machine learning, you can use these techniques to quickly add complex algorithms to your own code, making your software more capable and more useful.