如何在 TrainCustomModelAsync 表单识别器上定位本地路径

How to target Local Path on TrainCustomModelAsync Form Recognizer

有人可以向我解释 TrainModelAsync 如何访问 windows 上的本地路径作为源文件。 文档说:

The request must include a source parameter that is either an externally accessible Azure storage blob container Uri (preferably a Shared Access Signature Uri) or valid path to a data folder in a locally mounted drive. When local paths are specified, they must follow the Linux/Unix path format and be an absolute path rooted to the input mount configuration setting value e.g., if '' configuration setting value is '/input' then a valid source path would be '/input/contosodataset'. All data to be trained is expected to be under the source folder or sub folders under it. Models are trained using documents that are of the following content type - 'application/pdf', 'image/jpeg', 'image/png', 'image/tiff'. Other type of content is ignored.

  1. 什么是有效格式,例如我在 C:\input\ 中有火车文件?
  2. 输入挂载配置设置值是多少?

这是我的代码:(如果我将“源”属性 设置为 blob 存储,则此 运行 成功)

  var client = new HttpClient();
        var uri = "https://MYRESOURCENAME.cognitiveservices.azure.com/formrecognizer/v2.0-preview/custom/models/";
        // Request headers
        client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", ENDPOINT_KEY);

        var body =
            new
            {
                source = new Uri("C:\train\").AbsolutePath,
                sourceFilter = new
                {
                    prefix = "",
                    includeSubFolders = false
                },
                useLabelFile = true
            };


        StringContent stringContent = new StringContent(JsonConvert.SerializeObject(body), Encoding.UTF8, "application/json");
        var response = await client.PostAsync(uri, stringContent);

仅当您 运行 表单识别器服务作为您自己的 Docker/Kubernetes 环境中的容器时,本地路径选项才适用。托管表单识别器服务只能从 Azure Blob 容器读取训练数据 URL。

也就是说,本地容器目前仅适用于较旧的 v1.0 预览版。您可以在 https://docs.microsoft.com/en-us/azure/cognitive-services/form-recognizer/form-recognizer-container-howto

阅读有关 v1.0-preview 容器的更多信息