Custom Models - Train
Create 並定型自定義模型。 要求必須包含來源參數,該參數可能是外部可存取的 Azure 記憶體 Blob 容器 URI (最好是共用存取簽章 URI) 或本機掛接磁碟驅動器中數據資料夾的有效路徑。 指定本機路徑時,它們必須遵循Linux/Unix路徑格式,而且是根目錄為輸入掛接組態設定值的絕對路徑,例如,如果 '{Mounts:Input}' 組態設定值為 '/input',則有效的來源路徑會是 '/input/contosodataset'。 所有要定型的數據應該都位於源資料夾或子資料夾底下。 模型是使用下列內容類型的檔來定型 - 'application/pdf'、'image/jpeg'、'image/png'、'image/tiff' 或 'image/bmp'。 忽略其他類型的內容。
POST {endpoint}/formrecognizer/v2.1/custom/models
URI 參數
名稱 | 位於 | 必要 | 類型 | Description |
---|---|---|---|---|
endpoint
|
path | True |
string |
支援的認知服務端點 (通訊協定和主機名,例如: https://westus2.api.cognitive.microsoft.com) 。 |
要求標頭
名稱 | 必要 | 類型 | Description |
---|---|---|---|
Ocp-Apim-Subscription-Key | True |
string |
要求本文
名稱 | 必要 | 類型 | Description |
---|---|---|---|
source | True |
string |
包含定型檔的來源路徑。 |
modelName |
string |
選擇性使用者定義模型名稱 (長度上限:1024) 。 |
|
sourceFilter |
篩選以套用至來源路徑中的檔以進行定型。 |
||
useLabelFile |
boolean |
使用標籤檔案來定型模型。 |
回應
名稱 | 類型 | Description |
---|---|---|
201 Created |
要求已順利排入佇列。 標題 Location: string |
|
Other Status Codes |
回應實體隨附的非成功回應,其中包含有關錯誤的其他詳細數據。 |
安全性
Ocp-Apim-Subscription-Key
類型:
apiKey
位於:
header
範例
Train custom model |
Train custom model with subfolder filter options |
Train custom model
範例要求
POST {endpoint}/formrecognizer/v2.1/custom/models
{
"source": "{azure_blob_endpoint}/input/data1?sasToken"
}
範例回覆
Location: {endpoint}/formrecognizer/v2.1/custom/models/f973e3c1-1148-43bb-bea8-49d0603ab3a8
Train custom model with subfolder filter options
範例要求
POST {endpoint}/formrecognizer/v2.1/custom/models
{
"source": "{azure_blob_endpoint}/input/data1?sasToken",
"sourceFilter": {
"prefix": "",
"includeSubFolders": false
},
"useLabelFile": false
}
範例回覆
Location: {endpoint}/formrecognizer/v2.1/custom/models/f973e3c1-1148-43bb-bea8-49d0603ab3a8
定義
名稱 | Description |
---|---|
Error |
|
Error |
|
Train |
要求參數來定型新的自定義模型。 |
Train |
篩選以套用至來源路徑中的檔以進行定型。 |
ErrorInformation
名稱 | 類型 | Description |
---|---|---|
code |
string |
|
message |
string |
ErrorResponse
名稱 | 類型 | Description |
---|---|---|
error |
TrainRequest
要求參數來定型新的自定義模型。
名稱 | 類型 | 預設值 | Description |
---|---|---|---|
modelName |
string |
選擇性使用者定義模型名稱 (長度上限:1024) 。 |
|
source |
string |
包含定型檔的來源路徑。 |
|
sourceFilter |
篩選以套用至來源路徑中的檔以進行定型。 |
||
useLabelFile |
boolean |
False |
使用標籤檔案來定型模型。 |
TrainSourceFilter
篩選以套用至來源路徑中的檔以進行定型。
名稱 | 類型 | 預設值 | Description |
---|---|---|---|
includeSubFolders |
boolean |
False |
旗標,指出搜尋要前置處理的內容時,是否也需要包含前置詞資料夾集合內的子資料夾。 |
prefix |
string |
區分大小寫的前置詞字串,可篩選來源路徑中的檔以進行定型。 例如,使用 Azure 記憶體 Blob Uri 時,請使用前置詞來限制子資料夾進行定型。 |