我有一个用 Python 和 Keras 实现的神经网络。训练完成后,我导出了模型,并得到了两个文件:model.js 和 model.h5。现在我想在 .NET 项目中进行实时分类,并且我想使用经过训练的神经网络。
ML.NET 中是否有一种方法可以将使用 python 导出的模型和经过训练的权重加载到模型对象中?
我在文档[1]中看到可以加载以前保存的模型,但显然是存储在 .zip 中,我找不到格式(也许是为了制作一个从 python 获取模型并“翻译”它的脚本)到 ML.NET 模型。
显然hdf5格式是标准[2],有办法用ML.NET加载它吗?
[1] https://learn.microsoft.com/en-us/dotnet/machine-learning/how-to-guides/consuming-model-ml-net https://learn.microsoft.com/en-us/dotnet/machine-learning/how-to-guides/consuming-model-ml-net
[2] https://support.hdfgroup.org/HDF5/doc1.6/UG/10_Datasets.html https://support.hdfgroup.org/HDF5/doc1.6/UG/10_Datasets.html
ML.net 支持 ONNX 模型,如下所示example. https://github.com/dotnet/machinelearning-samples/tree/master/samples/csharp/getting-started/DeepLearning_ObjectDetection_Onnx
您可以通过以下方式将 keras 模型转换为 ONNX 模型WinML工具 https://learn.microsoft.com/en-us/windows/ai/windows-ml/convert-model-winmltools
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)