Can Windows ML learning models be accessed by C# outside of UWP?

China☆狼群 提交于 2021-01-28 03:50:34

问题


I have an ONNX model I wish to evaluate images against, from a C# Windows service (non UWP). I don't see any way to get to the Windows ML framework from C# outside of building a UWP app, is that correct?

I found this posting which seems to indicate that it is possible from C++.

Is there at least a well known COM wrapper or something for it?


回答1:


See here for an example on the Windows-Machine-Learning GitHub of a slightly different method of referencing Windows.AI.MachineLearning outside of UWP: https://github.com/Microsoft/Windows-Machine-Learning/tree/master/Samples/SqueezeNetObjectDetection/NETCore/cs

To recreate this sample create a .NET Core sample and add an assembly reference to the Windows.winmd file of the Windows SDK. The path to this file may look like: C:\Program Files (x86)\Windows Kits\10\UnionMetadata[version]\Windows.winmd.

This will allow you to access Windows.AI.MachineLearning in a non-UWP c# app. This sample uses an environment variable to parametrize the path to this Windows.winmd, but you can hard code this value if you'd like.



来源:https://stackoverflow.com/questions/55383185/can-windows-ml-learning-models-be-accessed-by-c-sharp-outside-of-uwp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!