In this repo, you will find sample apps that demonstrate how to use Windows ML to build machine learning applications, and tools that help verify models and troubleshoot issues during development on Windows 10.
For additional information on Windows ML, including step-by-step tutorials and how-to guides, please visit the Windows ML documentation.
WinML Code Generator (mlgen): a Visual Studio extension to help you get started using WinML APIs on UWP apps by generating a template code when you add a trained ONNX file into the UWP project. From the template code you can load a model, create a session, bind inputs, and evaluate with wrapper codes. See docs for more info.
WinMLRunner: a command-line tool that can run .onnx or .pb models where the input and output variables are tensors or images. It is a very handy tool to quickly validate an ONNX model. It will attempt to load, bind, and evaluate a model and print out helpful messages. It also captures performance measurements.
WinMLTools: a Python tool for converting models from different machine learning toolkits into ONNX for use with Windows ML.
- FNSCandyStyleTransfer\UWP\cs: a UWP C# app that uses the FNS-Candy style transfer model to make a cool image.
- SqueezeNetObjectDetection\UWP\cs: a UWP C# app that uses the SqueezeNet model to detect the predominant object in an image.
- SqueezeNetObjectDetection\Desktop\cpp: a classic desktop C++/WinRT app that uses the SqueezeNet model to detect the predominant object in an image.
- SqueezeNetObjectDetection\NETCore\cs: a .NET Core 2 application that uses the SqueezeNet model to detect the predominant object in an image.
- MNIST\UWP\cs: a UWP C# app that uses the MNIST model to detect numberic characters.
- MNIST\UWP\cppcx: a UWP C++/CX app that uses the MNIST model to detect numberic characters.
- CustomTensorization: a Windows Console Application (C++/WinRT) that shows how to do custom tensorization.
- Emoji8: a UWP C# app that uses the FER Emotion model to evaluate how well the user's facial expressions match randomly selected emojis.
- CustomOperatorCPU: a desktop app that defines multiple custom cpu operators. One of these is a debug operator which we invite you to integrate into your own workflow.
- AdapterSelection: a desktop app that demonstrates how to choose a specific device adapter for running your model
- PlaneIdentifier: a UWP app and a WPF app packaged with the Desktop Bridge, sharing the same model trained using Azure Custom Vision service. For step-by-step instructions for this sample, please see the blog post Upgrade your WinML application to the latest bits.
Using the samples
Visual Studio Extension for C++/WinRT for C++/WinRT apps
Do the following to add the C++/WinRT extension in Visual Studio.
- Go to Tools > Extensions and Updates.
- Select Online in the left pane and search for "WinRT" using the search box.
- Select the C++/WinRT extension, click Download, and close Visual Studio. The extension should install automatically.
- When the extension has finished installing, re-open Visual Studio.
The easiest way to use these samples without using Git is to download the zip file containing the current version (using the following link or by clicking the "Download ZIP" button on the repo page). You can then unzip the entire archive and use the samples in Visual Studio 2017.
Notes: Before you unzip the archive, right-click it, select Properties, and then select Unblock. Be sure to unzip the entire archive, and not just individual samples. The samples all depend on the SharedContent folder in the archive. In Visual Studio 2017, the platform target defaults to ARM, so be sure to change that to x64 or x86 if you want to test on a non-ARM device.
Reminder: If you unzip individual samples, they will not build due to references to other portions of the ZIP file that were not unzipped. You must unzip the entire archive if you intend to build the samples.
- For issues, file a bug on GitHub Issues.
- Ask questions on Stack Overflow.
- Vote for popular feature requests on Windows Developer Feedback or include your own request.
We're always looking for your help to fix bugs and improve the samples. Create a pull request, and we'll be happy to take a look.