代码之家  ›  专栏  ›  技术社区  ›  Justin XL

找不到使用WinML指定的ONNX文件

  •  1
  • Justin XL  · 技术社区  · 6 年前

    我正在尝试使用WinML加载ONNX模型,代码如下:

    private async Task InitializeModelAsync()
    {
        var path = @"ms-appx:///Assets/FER-Emotion-Recognition.onnx";
        var file = await StorageFile.GetFileFromApplicationUriAsync(new Uri(path));
        model = await CNTKGraphModel.CreateCNTKGraphModel(file);
    }
    

    这个项目可以编译,但是在运行时我得到了一个 System.IO.FileNotFoundException异常 :

    系统找不到指定的文件。

    我检查了两遍,但文件确实在正确的文件夹中。我做错了什么?

    1 回复  |  直到 6 年前
        1
  •  3
  •   lindexi    6 年前

    右键单击 onnx 文件,转到“属性”面板并将其生成操作设置为“内容”。

    然后,将Copy设置为Output Directory,以便在更新时进行复制。

    enter image description here

    enter image description here

    enter image description here

    Get started with Machine Learning