Table Information Extraction

更新时间:
复制 MD 格式

Overview

  • Table Information Extraction is a deep learning-based task for creating self-learning models that extract information. It is highly effective for data with relatively fixed layouts, such as tables and forms.

  • A model tuned on a training set of over 100 high-quality, annotated samples can achieve an accuracy of over 95%.

  • The Toolbox also provides a Classifier Management tool and a Field Type Management tool, allowing users to perform automatic classification, routing, and high-precision recognition of different data types through a single interface.

Benefits

  • High accuracy: Built on powerful Alibaba Cloud pre-trained models, a fine-tuned model can achieve over 95% recognition accuracy, even with varied layouts.

  • Few-shot learning: You can train and iterate on the model with a small amount of labeled data, and it will generalize well to unseen data.

  • Low barrier to entry: No code required. The service is ready to use out-of-the-box and features an intuitive interface for configuring custom rules.

  • High efficiency: Smart pre-annotation and collaborative annotation features significantly reduce data labeling time.

Use cases

  • Supports both list-based tables and key-value (KV) tables. It is ideal for images or single-page PDF files that require structured information extraction, and works with ruled, semi-bordered, and borderless tables that have a limited number of layout variations.

  • This service is suitable for scenarios that require continuous model optimization with large datasets.

Related links

Procedure

Watch the "Table Information Extraction Onboarding" video for a tutorial:

The workflow for creating a Table Information Extraction task is shown in the figure below. You need at least 20 training samples to start model training.

image

Step 1: Prepare data

In your Table Information Extraction project, go to Data Center > Dataset to upload and manage data for your model tasks. Click Add Dataset, enter a Dataset Name, and upload your relevant business data in table format.

Note

A custom Table Information Extraction model requires at least 20 training data samples to achieve good recognition and extraction performance.

Tips:

  1. What are the data requirements?

    1. You can upload images, documents, or compressed files to a dataset.

      1. Documents: Must be single-page PDF files no larger than 20 MB.

      2. Images: Must be in JPG, JPEG, or PNG format and no larger than 10 MB.

      3. Compressed files: Must be in ZIP format and no larger than 20 MB per file.

    2. For a single image, the longest side 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.

    3. For model training and evaluation, prepare 20 to 30 data samples of the same task type.

  2. How can I get better recognition results?

    1. For tasks within the product's scope, higher data quality leads to better recognition and extraction results. Clear and well-aligned text yields higher accuracy.

    2. For best recognition results, ensure that individual characters are between 10 and 50 pixels in size.

    3. Use data from real-world business scenarios, ensuring it covers a representative range of types and layouts.

Step 2: Annotate data

Data Annotation involves three main stages: creating an annotation task, annotating the data, and quality inspection.

Create an annotation task

On the Data Center > Annotation Task page, click Create Annotation Task. On the creation page, enter a Task Name and select a dataset to annotate or upload data from your local machine under Upload Data. After you are finished, proceed to Item Settings.

pre-annotation: If you enable OCR pre-annotation, the system automatically recognizes the text within a box after you draw it, improving annotation efficiency.

Item Library: For this task, you can select existing items from the Item Library. This helps you reuse annotation items across different tasks, which saves time and reduces configuration errors.

Field Name: This is the external name of the recognition field and corresponds to the field name in the API. Field names must be globally unique.

Field Type: Defines the attribute of a field. Choosing the correct field type can improve the end-to-end recognition performance. You can select from general field types or add your own custom ones. If no post-processing is needed, select a general field type.

Tips:

  1. How do I upload data for an annotation task?

    1. You can upload data from your local machine or select it from an existing dataset. If you have already uploaded your data to a dataset, click Add Dataset above the list and choose the one you want to annotate.

  2. How do I configure fields for Table Information Extraction?

    1. Table Information Extraction supports two types of items: fields, added by clicking Add Field, and tables, added by clicking Add Table.

    2. Add Field is for KV-structured fields. You must enter all the field names you want to annotate and select their corresponding field types.

    3. Add Table is for list-based tables. Click Add Table and enter the corresponding table header information.

Annotate

Go to the Data Center > Annotation Task page, select your newly created annotation task, and click Annotate. This opens the Data Annotation interface. Use the Box Selection tool from the toolbar to either Select Item or Create Table. After you have annotated all fields on all images, click Submit Task to complete this stage.

Important

The quality of your annotated data, including both the text content and its location, directly affects the model training performance and evaluation metrics.

You can skip any images that are corrupted or cannot be annotated.

Tips:

  1. How do I use the box selection tool?

    1. For flat text regions, use the Four-corner Box. For skewed text, use the Six-corner Box. Drawing boxes that fit snugly around the target fields improves recognition performance.

    2. OCR pre-annotation supports printed text but does not currently support handwritten text.

  2. How do I create a table?

    1. The Create Table tool is suitable for annotating headers and columns in list-based tables.

    2. If you plan to create tables, you must first select Add Table in the Item Settings section.

    3. Create Table details: After navigating to the Add Table tab, you must click Create Table and select the corresponding table template. The headers will appear in the right-side panel. Click the selection box for a table column, and then draw a box around the corresponding field in the image on the left. You must repeat this process to annotate every field for every header.

  3. How do I select items?

    1. The Select Item tool is suitable for annotating key-value fields in key-value (KV) tables.

    2. If you plan to select items, you must first select Add Field in the Item Settings section.

    3. For flat text regions, use the Four-corner Box. For skewed text, use the Six-corner Box. Drawing boxes that fit snugly around the target fields improves recognition performance.

    4. OCR pre-annotation supports printed text but does not currently support handwritten text. Carefully check the text automatically recognized by pre-annotation to ensure it is correct.

Quality inspection: Go to the Data Center > Annotation Task page, select a completed task, and click quality check to enter the quality inspection interface. You need to verify that all images and their fields are annotated correctly. If there are errors, you can make changes or click reject. If everything is correct, click Submit to complete the quality inspection.

The top of the quality inspection interface shows the review progress (for example, "Checking 1/5"), the number of errors, and the accuracy rate. The right-side panel displays specific error reasons, such as Not filled. You can click Mark as Corrected to resolve an issue. The bottom of the interface provides Annotation History, Cancel Error Mark, and Next Item buttons to help you process each item.

Tips:

  1. How do I perform a quality inspection?

    1. Quality inspectors can use the annotation tools to add, delete, or modify annotations directly.

    2. When a quality inspector clicks Submit, the quality inspection is considered complete for all images in the task.

  2. What should I do if I find low-quality annotations during the inspection?

    1. Select the corresponding item and edit it directly.

    2. Click reject to return the task to the annotator for re-processing.

Step 3: Train and evaluate the model

Go to the Model Center and click Create Model. Select the annotated datasets for your training and test sets, and fill in the basic information. After you create the model, model training starts automatically.

Training set: This is the data source used to train the model. You can only use annotated and quality-inspected datasets as a training set, and a dataset selected as a test set cannot also be used as a training set. We recommend using at least 20 valid data samples for model training.

Test set: This is the data source used to test the model. You can only use annotated and quality-inspected datasets as a test set, and a dataset selected as a training set cannot also be used as a test set.

If you enable this option, the system automatically reserves 1/10 of the training set for testing, so you do not need to provide a separate test set. Any manually uploaded test set will be ignored.

In the Table tab on the right side of the model training configuration page, you can view the configured table records. Each record shows the table name and the field type for each column, such as General or Alphanumeric. You can use the edit or delete actions to adjust the table configuration.

The model training fee and estimated duration vary based on the task type and data volume. The exact values are displayed on the interface. For more information, see OCR Self-learning billing.

Training duration: The time required for training depends on several factors, including data volume, annotation quality, and machine resources. For example, on a V100 machine, training on 20 images takes about 1 hour, while 200 images take about 2 hours.

Tips:

  1. You must verify that the fields in your training and test sets are consistent across both datasets.

  2. During the model training configuration, you can select the field type for each field or delete fields to improve training accuracy.

  3. Larger amounts of accurately annotated data result in better model training and evaluation performance.

  4. Configure appropriate field types to improve end-to-end accuracy.

After the model is created, you can view its basic information on the Model Details page, including version number, model ID, pre-trained model name, and the number of valid samples in the training and test sets. In the Field Information section, you can see a table preview on the left. On the right, use the Field and Table tabs to view the field type configuration for each column, such as 'General' and 'Alphanumeric'.

After model training is complete, the top of the Model Version page displays the training duration, start and end times, status, and Service Parameter Configuration. This configuration includes inference hardware, inference time, maximum training duration, and compute specification.

Algorithm evaluation metrics: Metrics are provided for three dimensions: overall, field, and table.

Overall metrics

  • Accuracy: The average accuracy of the algorithm model, not corrected by post-processing rules. It is the ratio of correctly predicted bounding boxes (content and position) to the total number of bounding boxes in the test set.image

  • Precision: The average precision of the algorithm model, not corrected by post-processing rules. It is the ratio of true positives to all positive predictions. In other words, it measures what proportion of the fields identified by the model match the ground truth annotation (content and position).image

  • Recall: The average recall of the algorithm model, not corrected by post-processing rules. It is the ratio of true positives to all actual positives in the data. In other words, it measures what proportion of the ground truth annotation boxes (content and position) in the test set were correctly identified.

image

Field metrics

  • Precision: The per-field precision of the algorithm model, not corrected by post-processing rules. For a specific field, this is the probability that a positive prediction is a true positive. It measures the proportion of identified instances of this field that match the ground truth annotation (content and position).image

  • Recall: The per-field recall of the algorithm model, not corrected by post-processing rules. For a specific field, this is the probability that an actual positive is correctly identified. It measures the proportion of all ground truth annotations for this field that were correctly identified (content and position).image

  • F1-score: A comprehensive evaluation metric (F1-score). It is the harmonic mean of precision and recall and is often used to evaluate the performance of classification models.image

Table metrics

  • Precision: The per-field-type precision for tables, not corrected by post-processing rules. This measures the proportion of correctly predicted fields of a certain type within a table compared to all predicted instances of that field type (content and position).image

  • Recall: The per-field-type recall for tables, not corrected by post-processing rules. This measures the proportion of correctly identified fields of a certain type within a table compared to all actual instances of that field type (content and position).image

  • F1-score: A comprehensive evaluation metric (F1-score). It is the harmonic mean of precision and recall and is often used to evaluate the performance of classification models.image

Tuning recommendations:

How do I tune the model?

  1. Ensure your task type is within the feature's scope and that your data quality is as high as possible, with clear and well-aligned text.

  2. During data annotation, make sure to completely annotate every field to be recognized. Bounding boxes should fit snugly around the text. You can also adjust field types or advanced options to improve accuracy.

  3. Model performance improves with the amount of accurately annotated data.

  4. Ensure the distribution of data types and layouts in your dataset reflects real-world scenarios. The model will only perform well on the types and layouts it has been trained on.

Step 4: Deploy the model

After model training is complete, go to Model Center > Model Details and click the deploy button to deploy the model. Deployment takes some time. Once successful, you can test the model's performance visually using the online experience or call the service directly via its API.

Note

After you publish and deploy the model service, you can refer to the API reference documentation to use the service. You can also go to the Try Online interface to test the model's performance.

Important

As of August 23, 2023, OCR Self-learning is fully commercialized. Model training is billed by duration, and model inference is billed by the number of calls. For details, see OCR Self-learning billing.

Item library

In the Item Settings stage, the Item Library lets you pre-define and reuse annotation items across multiple tasks. This reduces manual effort and configuration errors.

Note

Modifying the Item Library does not affect any annotation tasks or models that have already been created.