Customize table templates

更新时间:
复制 MD 格式

Overview

  • The custom table template feature extracts data from single-page, bordered tables with fixed layouts. Using a drag-and-drop interface, you can configure reference fields, recognition fields, or table areas with a single sample document, requiring no data labeling or model training. This process lets you extract structured data from any document with the same layout. After configuration and tuning, the template can achieve a recognition accuracy of over 85%.

  • Additionally, the toolbox offers tools for managing classifiers and field types. These tools let you automatically classify, route, and accurately recognize data from different layouts using a single API.

Benefits

  • Low cost: Set up a template with just one sample image. No data labeling is required.

  • Low barrier to entry: Define a template using a visual drag-and-drop interface. No secondary development is needed.

  • High efficiency: Configure a template in 3 to 5 minutes.

Use cases

  • Few-shot cold start: Ideal for scenarios where you have a small number of business samples (fewer than 20) and need to quickly launch and validate your service.

  • Fixed data layouts: Suitable for list-based and key-value tables with borders and fixed layouts. The styles, elements, and headers remain consistent, but cell height can be adjusted or the number of rows can be increased. Common applications include insurance claims (such as medical invoices and health checkup reports), bank transfers, annual audits, and business data structuring.

  • Note
    • Table templates support both key-value and list-based table form data, as well as the recognition of fields outside the table borders.

    • The smallest recognizable unit in a table is a single cell. The service cannot recognize smaller areas.

    • Cross-page tables or fields are not supported.

    • For key-value tables, cell height can be adjusted, but adding, splitting, or deleting cells is not supported.

    • For list-based tables, the header area must remain unchanged. The recognition area can have a variable number of rows, but merged cells are not supported.

Related links

Procedure

Custom table template demo

Create a custom table template

Follow the four steps shown in the figure below to create a template:

image

Step 1: Upload a template image

After you create a custom table template project, go to the project details page to create a template. On the Upload Template Image page, click Upload File to upload a clear and properly oriented template image. Then, configure the parameters based on the characteristics of your data.

You can select Chinese or English for Language, printed text or handwritten for Text Type, and enable auto-rotation for image processing. For red stamp processing, you can choose No Processing or Eliminate Red Stamp Impact.

Tips

  1. How to choose a template image

    1. For best results, use a scanned image that is clear, properly aligned, free of reflections, and contains all fields with complete table borders.

    2. Documents: Single-page PDF files up to 20 MB are supported.

    3. Images: JPG, JPEG, and PNG files up to 10 MB are supported.

  2. What are template parameters and how do I configure them?

    1. These parameters define the characteristics of the sample data, which helps preprocess the data and match it with the appropriate AI model to optimize processing results.

    2. Configuration options include language, text type, image processing, and red stamp processing.

    3. Parameter configurations are not applied or displayed in real time but take effect during template testing.

  3. What type of data yields the best recognition results?

    1. The longest side of a single image cannot exceed 8,192 pixels, and the shortest side must be at least 15 pixels. If the longest side exceeds 1,024 pixels, the aspect ratio must not exceed 50:1.

    2. For optimal recognition, we recommend that the size of a single character is between 10 and 50 pixels.

    3. Significant differences in camera angle or orientation between the template image and the actual business data can affect recognition accuracy.

Step 2: Select reference fields

Go to the reference field selection page. From the toolbar on the left, click the Select button to draw boxes around text or table cells in the template image that have fixed content and position, such as table headers.

For example, in a cash flow statement template, you can select header cells such as Prepared by, Item, Notes, 2021, and 2020 as reference fields. After you select the fields, the Reference Fields panel on the right lists all configured reference fields. In a scholarship application form template, you might select fields such as Name, Gender, Date of Birth, Household Registration, and Total Household Members as reference fields. The Reference Fields panel then displays the list of configured fields.

Reference fields

A reference field is an element with fixed content and position across documents of the same layout. We recommend selecting reference fields that are distributed around the edges of the page. Within a table, select the entire cell as a reference field. These fields also affect performance when using a combined classifier.

Tips

  1. How to select reference fields

    1. Select at least six reference fields. For key-value documents, try to distribute the reference fields across the four corners of the page.

    2. Select in-table reference fields at the cell level.

    3. Ensure that the text content and cell position of the selected reference fields are fixed.

    4. Only Chinese characters, English letters, and numbers are supported. Symbols and patterns are not allowed.

  2. What if I cannot find at least six reference fields?

    1. This step is optional, as the underlying algorithm can analyze the document automatically. However, careful configuration of reference fields is required when using a combined classifier for templates with very similar layouts.

Step 3: Configure recognition fields

Go to the recognition field configuration page. From the toolbar on the left, use the Select button to draw boxes around the fields and tables to be recognized. For each selected field, you must enter a field name, verify its value, and choose a field type. You can also configure advanced settings to improve accuracy. For list-based tables, you must also define header fields and , providing a column name and verifying the header value for each header.

Recognition fields

A recognition field is an area on the image that you want to recognize. It contains the information you need for your business and is used to generate structured output. Each recognition field has required properties, including a field name, a value, and a field type. Each table has required properties, including header fields, recognition column fields, a column name, a header value, and a field type. Advanced settings are optional.

Field name: The externally exposed name for the recognition field, which corresponds to the name in the API. The field name must be globally unique.

Value

The content of the recognition field, which is automatically recognized and populated after you select the area. If you need to post-process a specific field (for example, normalizing a date, extracting only digits from an amount, or replacing symbols using a regular expression), you can use the field type and advanced settings. These settings are applied when you make an API call.

Column name: The externally exposed name for a column in a list-based table, which corresponds to the name in the API. To set it, click a header field. The column name must be globally unique.

Header value

The content of the header field, which is automatically recognized and populated after you select the area. To improve accuracy, you can apply post-processing rules using field types and advanced settings, which take effect during an API call.

Tips

  1. How to select recognition fields

    1. Select the location of the text for each field you want to extract, one by one.

    2. For recognition fields outside a table, draw a box that covers the largest possible area where the field's text might appear. This helps prevent incomplete recognition.

    3. For table fields, the smallest unit is a cell. The selection box must align as closely as possible with the cell borders.

  2. How to improve the accuracy of recognition fields

    1. Choose an appropriate field type to improve recognition results. You can select a common field type or add your own custom field type. If no post-processing is needed, select a regular field type.

    2. If you need to replace content or set a multi-line connector, configure the advanced settings.

    3. In the advanced settings, you can use a regular expression to define string replacement rules. See the following examples.

    Remarks

    Input

    Original content

    Replacement

    Result

    Replace a string

    abcdef

    abc

    hello

    hellodef

    Remove extra spaces

    ab de f

    \s+

    abdef

    Add a decimal point before the second-to-last digit

    12345

    (\d+)(\d{2})$

    \1.\2

    123.45

    Remove content before a colon

    Mobile:12345678

    .+:(\d+)

    \1

    12345678

    Reformat a date

    2023-02-03

    (\d{4})-(\d{2})-(\d{2})

    \1year\2month\3day

    February 3, 2023

Step 4: Test and release template

After selecting all reference and recognition fields, test and release the template. Click Upload File and upload an image with the same layout to test performance. If the results are satisfactory, click Publish template and start API call.

After the test completes, the test image appears on the left, with the recognition results in a panel on the right. View the extracted data for each field in a key-value table on the Structured information tab, or on the JSON response tab to see the output in JSON format. Use the Re-upload button in the lower-left corner to change the test image.

Template tuning

  1. What should I do if the test image does not match the template?

    1. Confirm that the uploaded test image and the template image have the same layout.

    2. Adjust the selection area for the reference fields or choose different ones to improve template matching accuracy.

  2. What should I do if the recognition results are incomplete?

    1. Adjust the selection area for the recognition fields. To ensure complete extraction, make sure the box covers the largest possible area where the field's text might appear.

    2. Check if the table borders in the test image are complete.

    3. Check the field type selection. For example, if numbers are being recognized as letters, change the field type of this recognition field.

    4. Check the advanced settings for the field.

  3. What should I do if a recognition field is incorrect?

    1. Check the field type selection. For example, changing the type from regular to numeric can improve the recognition accuracy for that field.

    2. Check if the selection box for the recognition field aligns closely with the table cell area.

    3. Check the advanced settings for the field.

  4. What should I do if the selection boxes are offset in the test results?

    1. Check if the reference fields and recognition fields are selected correctly.

    2. Check if the template image meets the requirements.

Template management

After publishing the template, go to the project details page to view its overview, which includes the template's basic information, configuration details, and usage data. Published templates can be used via API calls or online.

Note

Note:

  • You must activate the custom table template service to make calls to a published template. Usage data is available on the details dashboard. Both API calls and online use are billable. For details, see the billing overview document.

  • After a template is published, you can use the service via the online testing feature or API calls.