Inference of onnx model (opset11) in Windows 10 c++? - windows-runtime

In order to use my custom TF model through WinML, I converted it to onnx using the tf2onnx converter. The conversion finally worked using opset 11. Unfortunately I cannot load the model in the WinRT c++ library, therefore I am confused about the opset support: According to the Release Notes, the latest WinML release in May supports opset 11. I updated my VS2019 and downloaded the latest Windows 10 SDK, does the c++ API already include the latest onnx support? Or is there any alternative way to use my model in WinML c++?

The latest release of Windows OS contains support for opset 9.
The latest release of Microsoft.AI.MachineLearning NuGet package contains support for opset 11.
Please refer to these release notes: https://learn.microsoft.com/en-us/windows/ai/windows-ml/release-notes
You can find the latest Microsoft.AI.MachineLearning NuGet package here: https://www.nuget.org/packages/Microsoft.AI.MachineLearning/

As #Kookei mentioned, there are 2 ways of building WinML: the "In-Box" way and the NuGet way.
In-Box basically just means link to whatever WinML DLLs that are included with Windows itself (e.g., in C:\Window\System32).
The NuGet package contains its own more recent set of DLLs, which other than providing support for the latest ONNX opset, has the obvious advantage of allowing you to easily distribute your binary to older versions of Windows lacking any built-in machine learning capability. Just install the package through Visual Studio's Nuget Package Manager, and build your solution; and you'll find that the output directory now contains the needed DLLs (currently directml.dll, Microsoft.AI.MachineLearning.dll, and onnxruntime.dll) along with the generated EXE, ready for same-folder deployment.
In terms of source code, this is how the two versions are distinguished:
In-Box:
#include <winrt/Windows.AI.MachineLearning.h>
using WinMLModel = winrt::windows::AI::MachineLearning
NuGet:
#include <winrt/Microsoft.AI.MachineLearning.h>
using WinMLModel = winrt::Microsoft::AI::MachineLearning
In other words, the only difference is whether you use the Window or Microsoft header/namespace.

you can also track the supported opset versions at the version matrix table.

Related

Cannot find type System.Windows.Media.AudioSink in module System.Windows.dll for windows 8

In my Windows Store Application, I am getting the error:
Cannot find type System.Windows.Media.AudioSink in module System.Windows.dll
I tried to add a reference to it, but I can't find an assembly list in my project's references.
My system:
OS - Windows 8.1
IDE - Visual studio 2013
The .NET Core for Windows Store Applications does not include all of .NET 4.5 (nor 4.5.1). It is a subset of it, meaning that not all classes are included. It also has some classes specific to it.
If you want to do audio, you should look into the Getting Started with Audio and Video tutorial that Microsoft created for this very purpose.
Also, in the future you should probably include what language you are using. There are multiple languages that Windows Store Apps can be created in (C#,C++/XAML, Javascript/HTML), and it helps to know that.

Why use Service.Model from Silverlight for WindowsPhone?

I understood Silverlight was drop by MS.
I create my first app permitting to read RSS in WindowsPhone and I need to add a reference to System.ServiceModel.Syndication.dll. In the doc http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh487167(v=vs.105).aspx, I need to find this lib in Microsoft SDKs/Silverlight/v4.0/Libraries/Client/.Why should I do it? Why I can't add directly a lib from the standard .net4?
Can you help me to understand.
[UPDATE]
When I add the lib from C:\Program Files (x86)\Microsoft SDKs\Silverlight\v4.0\Libraries\Client\
Visual Studio shows a windows "Adding reference to Windows Phone XNA assembly is safe. However adding reference to a silverlight assembly may lead to unexpexted application behavior. Do you want to continue.
So my assumption is this lib shoudn't be use but I don't find another way.
Maybe by add a ref from .Net 4 or 4.5.
Best regards,
Alexandre
The Windows Phone 7 SDK was built on top of Silverlight. For Windows Phone 8 this was changed so that there isn't a direct history with Silverlight but it was based on WinRT instead. Lots of functionality was made available to Silverlight controls to support backwards compatibility with apps written for 7.
Because WinRT is not compatible with classes written for the full version of the framework you cannot use these in your Windows Phone apps.
The warning you are getting is just a warning. It's telling you that your doing something that isn't an ideal and so you may have issues. Unfortunately there are no other versions of the SyndicationFeed object available to Windows Phone apps so you'll need to use this library if you want the functionality of SyndicationFeed without recreating it yourself. The good news is that there are no issue with using this class in your app. Just be sure to test carefully, on real devices, if you start to use other functionality from that assembly because, as the warning says: "there may be unexpected behaviour".

How to create a PPAPI plugin for Google Chrome in Windows?

I am new to PPAPI development and have downloaded the already examples from here
However, even after coming across the documentation,
I am not able to build the project.
I have Microsoft Visual Studio 2010, Windows OS and Chrome:30.0.1599.65
I understand that once a dll is created, using the regsvr32 command will register the plugin, although getting the dll, even with available code, seems tough for me. Any help for building the dll is appreciated.
You will want to start here to download the and set up the SDK: https://developers.google.com/native-client/sdk/download
This page will take you through how to build and run the examples: https://developer.chrome.com/native-client/sdk/examples
This page goes over how to actually create your own plugin: https://developer.chrome.com/native-client/devguide/tutorial/tutorial-part1
And then you should read this entire section to code and structure your application: https://developer.chrome.com/native-client/devguide/coding/application-structure
If you need any third party libraries be sure to check here: https://chromium.googlesource.com/webports
Edit: Forgot to mention that you will want to use the same version of the pepper api as the version of chrome you're running (in this case pepper_30). Also, you have to use the NaCl toolchain (one of either glibc, newlib, or pnacl); you can't use the Visual C/C++ toolchains. I recommend trying pnacl now that it is available, as that is by far the most cross platform version, but if you run into trouble, you'll probably want to use the newlib toolchain as it has better support.

How targeting .NET 4.0 with Mvvmcross?

I want to use Mvvmcross to make application for several platforms.
I use Profile 104 for PCL library like Mvvmcross, but this profile target .NET 4.5.
I want to target .NET 4.0 to use my application on Windows XP.
To do that, I add the xml files
MonoAndroid, Version = v1.6 +. Xml
and
VSMonoTouch, Version = v1.0 +. Xml
in the profile 143 which allows me to target. NET framework 4.0.3.
However, I have a compilation error because it can not find the ICommand interface.
This interface is not in the same library between version 4.0 and 4.5, is it why it doesn't work ?
Or should I recompile all Mvvmcross libraries with profile 143?
thanks,
This is a Portable Class Library limitation.
See the table on: http://msdn.microsoft.com/en-us/library/gg597391.aspx
Model-View-View Model (MVVM)
Only 4.5
This means that if anyone wants to use MvvmCross on earlier .Net platforms then someone has to build and maintain a non-PCL version.
Since the maintainer of Mvx (me!) has decided to only maintain PCL versions of MvvmCross, then any non-PCL support will have to be created by the community.
For WPF this shouldn't be too large or difficult a job - but it might be...
Alternatively, somebody might be able to do something funky to get the ICommand working... I've retagged this question with portable-class-library to try to lure in some of the MS experts.

How do I use JSON.Net on a new Mono class library?

I wish to use JSON.Net on a brand spankin new Mono class library (say .. Mono / .NET 4). Of course, this class library will be used by a MonoTouch iPhone/iPad project (also in the same solution).
I'm not sure of the steps I need to do, to use JSON.Net in a Mono Class Library.
The closest I got to this was this SO question .. but it said nothing about how the DLL was made, where it exists, etc.
BTW: I'm also using MonoDevelop for the IDE. This is on a Mac OSX.
If your mono is new enough, you can in fact use NuGet downloaded from here. You also need some trusted certificates to get it working well - they can be imported using:
mozroots --import --ask-remove
And then you can download the package using NuGet
You can also download the library any other way - no need to recompile the sources as Mono and .NET are binary compatible.
Btw, binaries can be directly downloaded from nuget in a way like that:
Json.Net.