PredictClassifierModel

Updated at:

Performs prediction using the document self-learning classifier.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

documentautoml:PredictClassifierModel

get

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

ClassifierId

integer

No

The classifier ID.

1

AutoPrediction

boolean

No

Specifies whether to enable automatic prediction. Valid values:

  • false: Disabled.

  • true: Enabled.

Default value: true.

true

Content

string

No

The accessible URL of an image or PDF file.

https://doc-automl-public.oss-cn-hangzhou.aliyuncs.com/demo/table.png

Body

string

No

The Base64 encoding content of the image.

data:image/png;base64,xxxxx

BinaryToText

boolean

No

Specifies whether the input is Base64-encoded content. Set this parameter to false when the Content field is an image URL. Set this parameter to true when the Body field contains Base64-encoded content.

false

content 字段和 body 字段传参二选一,图片 URL 则 content 为图片访问地址。内容为 base64 编码则传参 body,且 BinaryToText 传 true。

pdf 限制 20Mb,10 页。 除了长文档类型的模型预测以外,其他预测服务只会取第一页进行预测。

Response elements

Element

Type

Description

Example

object

Schema of Response

RequestId

string

Id of the request

232B91A8-9938-5C10-B522-127D1E342A57

Code

integer

The response code indicating success.

200

Data

object

The returned data.

{ "score": 1, "classID": "269_2b6819527769749d962bf51d034b1820", "tables": [ { "columns": [ { "header_value": "Name", "bodies": [ { "prob": 0, "fieldWordRaw": "Student1", "wordInfo": [], "location": [ { "x": 76, "y": 99 }, { "x": 187, "y": 99 }, { "x": 187, "y": 123 }, { "x": 76, "y": 123 } ], "value": "Student1" }, { "prob": 0, "fieldWordRaw": "Student2", "wordInfo": [], "location": [ { "x": 76, "y": 123 }, { "x": 187, "y": 123 }, { "x": 187, "y": 146 }, { "x": 76, "y": 146 } ], "value": "Student2" }, { "prob": 0, "fieldWordRaw": "Student3", "wordInfo": [], "location": [ { "x": 76, "y": 146 }, { "x": 187, "y": 146 }, { "x": 187, "y": 169 }, { "x": 76, "y": 169 } ], "value": "Student3" }, { "prob": 0, "fieldWordRaw": "Student4", "wordInfo": [], "location": [ { "x": 76, "y": 169 }, { "x": 187, "y": 169 }, { "x": 187, "y": 191 }, { "x": 76, "y": 191 } ], "value": "Student4" }, { "prob": 0, "fieldWordRaw": "Student5", "wordInfo": [], "location": [ { "x": 76, "y": 191 }, { "x": 187, "y": 191 }, { "x": 187, "y": 215 }, { "x": 76, "y": 215 } ], "value": "Student5" }, { "prob": 0, "fieldWordRaw": "Student6", "wordInfo": [], "location": [ { "x": 76, "y": 215 }, { "x": 187, "y": 215 }, { "x": 187, "y": 238 }, { "x": 76, "y": 238 } ], "value": "Student6" }, { "prob": 0, "fieldWordRaw": "Student7", "wordInfo": [], "location": [ { "x": 76, "y": 238 }, { "x": 187, "y": 238 }, { "x": 187, "y": 261 }, { "x": 76, "y": 261 } ], "value": "Student7" }, { "prob": 0, "fieldWordRaw": "Student8", "wordInfo": [], "location": [ { "x": 76, "y": 261 }, { "x": 187, "y": 261 }, { "x": 187, "y": 283 }, { "x": 76, "y": 283 } ], "value": "Student8" }, { "prob": 0, "fieldWordRaw": "Student9", "wordInfo": [], "location": [ { "x": 76, "y": 283 }, { "x": 187, "y": 283 }, { "x": 187, "y": 307 }, { "x": 76, "y": 307 } ], "value": "Student9" }, { "prob": 0, "fieldWordRaw": "Student10", "wordInfo": [], "location": [ { "x": 76, "y": 307 }, { "x": 187, "y": 307 }, { "x": 187, "y": 330 }, { "x": 76, "y": 330 } ], "value": "Student10" }, { "prob": 0, "fieldWordRaw": "", "wordInfo": [], "location": [ { "x": 76, "y": 330 }, { "x": 187, "y": 330 }, { "x": 187, "y": 352 }, { "x": 76, "y": 352 } ], "value": "" }, { "prob": 0, "fieldWordRaw": "", "wordInfo": [], "location": [ { "x": 76, "y": 352 }, { "x": 187, "y": 352 }, { "x": 187, "y": 375 }, { "x": 76, "y": 375 } ], "value": "" }, { "prob": 0, "fieldWordRaw": "", "wordInfo": [], "location": [ { "x": 76, "y": 375 }, { "x": 187, "y": 375 }, { "x": 187, "y": 399 }, { "x": 76, "y": 399 } ], "value": "" }, { "prob": 0, "fieldWordRaw": "", "wordInfo": [], "location": [ { "x": 76, "y": 399 }, { "x": 187, "y": 399 }, { "x": 187, "y": 422 }, { "x": 76, "y": 422 } ], "value": "" }, { "prob": 0, "fieldWordRaw": "", "wordInfo": [], "location": [ { "x": 76, "y": 422 }, { "x": 187, "y": 422 }, { "x": 187, "y": 444 }, { "x": 76, "y": 444 } ], "value": "" }, { "prob": 0, "fieldWordRaw": "", "wordInfo": [], "location": [ { "x": 76, "y": 444 }, { "x": 187, "y": 444 }, { "x": 187, "y": 467 }, { "x": 76, "y": 467 } ], "value": "" }, { "prob": 0, "fieldWordRaw": "", "wordInfo": [], "location": [ { "x": 76, "y": 467 }, { "x": 187, "y": 467 }, { "x": 187, "y": 491 }, { "x": 76, "y": 491 } ], "value": "" }, { "prob": 0, "fieldWordRaw": "", "wordInfo": [], "location": [ { "x": 76, "y": 491 }, { "x": 187, "y": 491 }, { "x": 187, "y": 514 }, { "x": 76, "y": 514 } ], "value": "" }, { "prob": 0, "fieldWordRaw": "", "wordInfo": [], "location": [ { "x": 76, "y": 514 }, { "x": 187, "y": 514 }, { "x": 187, "y": 536 }, { "x": 76, "y": 536 } ], "value": "" }, { "prob": 0, "fieldWordRaw": "", "wordInfo": [], "location": [ { "x": 76, "y": 536 }, { "x": 187, "y": 536 }, { "x": 187, "y": 559 }, { "x": 76, "y": 559 } ], "value": "" } ], "header_box": [ { "x": 96, "y": 79 }, { "x": 162, "y": 79 }, { "x": 162, "y": 98 }, { "x": 96, "y": 98 } ], "col_name": "name" }, { "header_value": "Gender", "bodies": [ { "prob": 0, "fieldWordRaw": "Male", "wordInfo": [], "location": [ { "x": 187, "y": 100 }, { "x": 296, "y": 100 }, { "x": 296, "y": 123 }, { "x": 187, "y": 123 } ], "value": "Male" }, { "prob": 0, "fieldWordRaw": "Male", "wordInfo": [], "location": [ { "x": 187, "y": 123 }, { "x": 296, "y": 123 }, { "x": 296, "y": 146 }, { "x": 187, "y": 146 } ], "value": "Male" }, { "prob": 0, "fieldWordRaw": "Male", "wordInfo": [], "location": [ { "x": 187, "y": 146 }, { "x": 296, "y": 146 }, { "x": 296, "y": 169 }, { "x": 187, "y": 169 } ], "value": "Male" }, { "prob": 0, "fieldWordRaw": "Male", "wordInfo": [], "location": [ { "x": 187, "y": 169 }, { "x": 296, "y": 169 }, { "x": 296, "y": 191 }, { "x": 187, "y": 191 } ], "value": "Male" }, { "prob": 0, "fieldWordRaw": "Male", "wordInfo": [], "location": [ { "x": 187, "y": 191 }, { "x": 296, "y": 191 }, { "x": 296, "y": 215 }, { "x": 187, "y": 215 } ], "value": "Male" }, { "prob": 0, "fieldWordRaw": "Male", "wordInfo": [], "location": [ { "x": 187, "y": 215 }, { "x": 296, "y": 215 }, { "x": 296, "y": 238 }, { "x": 187, "y": 238 } ], "value": "Male" }, { "prob": 0, "fieldWordRaw": "Female", "wordInfo": [], "location": [ { "x": 187, "y": 238 }, { "x": 296, "y": 238 }, { "x": 296, "y": 261 }, { "x": 187, "y": 261 } ], "value": "Female" }, { "prob": 0, "fieldWordRaw": "Female", "wordInfo": [], "location": [ { "x": 187, "y": 261 }, { "x": 296, "y": 261 }, { "x": 296, "y": 283 }, { "x": 187, "y": 283 } ], "value": "Female" }, { "prob": 0, "fieldWordRaw": "Female", "wordInfo": [], "location": [ { "x": 187, "y": 283 }, { "x": 296, "y": 283 }, { "x": 296, "y": 307 }, { "x": 187, "y": 307 } ], "value": "Female" }, { "prob": 0, "fieldWordRaw": "Female", "wordInfo": [], "location": [ { "x": 187, "y": 307 }, { "x": 296, "y": 307 }, { "x": 296, "y": 330 }, { "x": 187, "y": 330 } ], "value": "Female" }, { "prob": 0, "fieldWordRaw": "", "wordInfo": [], "location": [ { "x": 187, "y": 330 }, { "x": 296, "y": 330 }, { "x": 296, "y": 352 }, { "x": 187, "y": 352 } ], "value": "" }, { "prob": 0, "fieldWordRaw": "", "wordInfo": [], "location": [ { "x": 187, "y": 352 }, { "x": 296, "y": 352 }, { "x": 296, "y": 375 }, { "x": 187, "y": 375 } ], "value": "" }, { "prob": 0, "fieldWordRaw": "", "wordInfo": [], "location": [ { "x": 187, "y": 375 }, { "x": 296, "y": 375 }, { "x": 296, "y": 399 }, { "x": 187, "y": 399 } ], "value": "" }, { "prob": 0, "fieldWordRaw": "", "wordInfo": [], "location": [ { "x": 187, "y": 399 }, { "x": 296, "y": 399 }, { "x": 296, "y": 422 }, { "x": 187, "y": 422 } ], "value": "" }, { "prob": 0, "fieldWordRaw": "", "wordInfo": [], "location": [ { "x": 187, "y": 422 }, { "x": 296, "y": 422 }, { "x": 296, "y": 444 }, { "x": 187, "y": 444 } ], "value": "" }, { "prob": 0, "fieldWordRaw": "", "wordInfo": [], "location": [ { "x": 187, "y": 444 }, { "x": 296, "y": 444 }, { "x": 296, "y": 467 }, { "x": 187, "y": 467 } ], "value": "" }, { "prob": 0, "fieldWordRaw": "", "wordInfo": [], "location": [ { "x": 187, "y": 467 }, { "x": 296, "y": 467 }, { "x": 296, "y": 491 }, { "x": 187, "y": 491 } ], "value": "" }, { "prob": 0, "fieldWordRaw": "", "wordInfo": [], "location": [ { "x": 187, "y": 491 }, { "x": 296, "y": 491 }, { "x": 296, "y": 514 }, { "x": 187, "y": 514 } ], "value": "" }, { "prob": 0, "fieldWordRaw": "", "wordInfo": [], "location": [ { "x": 187, "y": 514 }, { "x": 296, "y": 514 }, { "x": 296, "y": 536 }, { "x": 187, "y": 536 } ], "value": "" }, { "prob": 0, "fieldWordRaw": "", "wordInfo": [], "location": [ { "x": 187, "y": 536 }, { "x": 296, "y": 536 }, { "x": 296, "y": 559 }, { "x": 187, "y": 559 } ], "value": "" } ], "header_box": [ { "x": 210, "y": 78 }, { "x": 267, "y": 78 }, { "x": 267, "y": 100 }, { "x": 210, "y": 100 } ], "col_name": "sex" }, { "header_value": "File No.", "bodies": [ { "prob": 0, "fieldWordRaw": "D001",

Message

string

The error message.

success

分类器服务预测接口,返回 Data 字段解释说明:

score         预测服务置信度 0-1
data          算法返回的预测结果,数组格式 
tables        表格区域预测结果
prob          算法结果置信度 0-1 
fieldName     抽取 key 
fieldWord     抽取 value 
location      抽取结果坐标位置 { "x": 119,"y": 48 }表示页面坐标点 
wordInfo      抽取内容详细信息,包括了每个字符的位置信息 
specificType  算法类型(infoCustomeKvTemp:自定义 KV 模板,infoCustomeTableTemp:自定义表格模板,ocr_infoExtractBill:信息抽取 OCR 识别,infoExtractBill:单据票证抽取,infoExtractDoc:长文档信息抽取 )
classType     模型预测服务、模板预测服务 
predictFile   预测文件地址(失效时间 60 分钟)

Examples

Success response

JSON format

{
  "RequestId": "232B91A8-9938-5C10-B522-127D1E342A57",
  "Code": 200,
  "Data": {
    "test": "test",
    "test2": 1
  },
  "Message": "success"
}

Error codes

HTTP status code

Error code

Error message

Description

200 21002 模板预测超时
200 21003 模板预测失败
200 21004 模板提交失败
200 10001 参数出错
200 10002 没有权限
200 10003 非法状态
200 10005 服务不存在
200 21018 未找到模板信息
200 16001 未找到可预测的模型
200 16004 指定的模型不存在
200 23002 获取资源HTTP异常
200 22002 ocr服务异常
200 11002 账号没有开通服务
200 19999 未知异常

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.