Dan*_*oft 2 microsoft-cognitive
我正在尝试使用 Forms Recognizer 预览,经过多次反复试验,我终于通过 SAS URL 读取了文档。但是,即使使用快速入门 [1] 中提供的示例文档,我也会得到以下响应:
{
"modelId": "d7ba79e3-38bc-4913-bb11-82656cb08adc",
"trainingDocuments": [
{
"documentName": "Invoice_1.pdf",
"pages": 1,
"errors": [
"Page 1: Document is either invalid or exceeds the page/size limits."
],
"status": "failure"
},
{
"documentName": "Invoice_2.pdf",
"pages": 1,
"errors": [
"Page 1: Document is either invalid or exceeds the page/size limits."
],
"status": "failure"
},
{
"documentName": "Invoice_3.pdf",
"pages": 1,
"errors": [
"Page 1: Document is either invalid or exceeds the page/size limits."
],
"status": "failure"
},
{
"documentName": "Invoice_4.pdf",
"pages": 1,
"errors": [
"Page 1: Document is either invalid or exceeds the page/size limits."
],
"status": "failure"
},
{
"documentName": "Invoice_5.pdf",
"pages": 1,
"errors": [
"Page 1: Document is either invalid or exceeds the page/size limits."
],
"status": "failure"
}
],
"errors": [
{
"errorMessage": "Unable to fit model. No documents clustered."
}
]
}
Run Code Online (Sandbox Code Playgroud)
要使这些文档可用,是否需要在 BLOB 存储端发生一些特殊的事情?
即使在我们自己的基本形式上,我也收到了此错误消息,这完全符合大小限制。
更新:我认为这归结为我如何生成 SAS URL(其中文档根本不清楚)的一些问题。我有一个存储帐户 (SA),带有一个容器 (C),其中包含所有 PDF 文件。
在 Azure 门户中,我选择 SA 边栏选项卡,然后选择共享访问签名,采用所有默认选项,然后选择生成 SAS 和连接字符串。我尝试直接获取Blob 服务 SAS URL值并将其传递到source字段中,但这给出了错误:
{
"error": {
"code": "2024",
"innerError": {
"requestId": "77e73ba0-cbfe-4046-9730-beff8ec38be5"
},
"message": "Unable to list blobs on the Azure Blob storage account."
}
}
Run Code Online (Sandbox Code Playgroud)
我不得不添加&comp=list&restype=container到source,然后文件被正确列出,但出现上述错误。显然,除了 Azure Potral 生成的内容之外,还需要向 SAS URL 添加一些内容,而我添加的内容只是其中的一部分。
我想念能够在 REST 负载中发送文档内容本身来训练模型。:-(
我也遇到了这个问题,因为我没有发现快速入门文档很清楚 - 公平地说,对微软来说,这部分是因为我没有在 Azure 中生成 SAS URL 的经验,而且自从@ iamsop 向他们提出了一个 GitHub 问题。
我做了以下笔记,这些笔记描述了我是如何让它工作的。希望他们将来能帮助其他人:
curl -X POST "{endpoint}/formrecognizer/v1.0-preview/custom/train" -H "Content-Type: application/json" -H "Ocp-Apim-Subscription-Key: {subscription key}" -- data-ascii "{'source': '{SAS url}'}"
(注意:我个人对上述命令的偏好是在“data-ascii”值中使用单引号而不是双引号,因为这样您就不需要转义它们,使命令更易于阅读和编写)
| 归档时间: |
|
| 查看次数: |
1546 次 |
| 最近记录: |