Box-selecting Recognition Areas

A recognition area refers to the position where the text to be recognized resides. Images to be recognized contain fields in recognition areas and the positions of the recognition areas are fixed.

Therefore you need to box-select recognition areas in the template image to determine the position of text to be identified in images so that the model is able to locate the text to be recognized by identifying recognition areas.

Prerequisites

You have created an application using the multi-template classification workflow and box-selected reference fields on the OCR Suite console. For details, see Box-selecting Reference Fields.

Procedure

Figure 1 Box-selecting recognition areas
  1. Choose Application Development > Box-select Reference Fields. Click to select the desired template and box-select recognition areas for each template.
  2. Click the required operation icons in the upper left corner to adjust the size of the current template image.
  3. Click , move the pointer to the upper left corner of the text to be recognized, and box-select the area where the text resides.

    The selected recognition area should be as wide as possible so that the selected recognition area covers the area where the field value may appear.

  4. In Box-select Recognition on the right, specify Selected Field and Field Type.

    Field Type refers to the type of text to be recognized. You can select a field type from the Default Field Type drop-down list. The following default field types are supported: Name, Number, General, Phone number, Address, Amount, Long number, and Long field. You can select multiple field types for each recognition area.

    If the default field types cannot meet your service requirements, you can click Add Field Type in the drop-down list to add new field type. For details, see Creating a Field Type.

  5. When box-selecting and verifying recognition areas of all template images, click Next to go to step Uploading Training Sets.

Creating a Field Type

If the default field types in the Box-select Recognition page cannot meet your service requirements, you can create a field type.

  1. Choose Application Development > Box-select Recognition, click , move the pointer to the upper left corner of the text to be recognized, and drag the mouse to box-select the recognition area.
  2. Click the Field Type drop-down list in the Box-select Recognition area on the right and click Add Field Type on the bottom to create a field type.

    The Create Field Type dialog box is displayed.

  3. Specify related parameters.
    Figure 2 Creating a field type

    Field Type Name: Enter the name of a field type to be created. For example, if you want to recognize an image of an ID card, you can create a field type named Birthday.

    Field Attribute: Select a field attribute from the drop-down list. The options are Custom regular expression extraction or Custom dictionary, and then enter related information by referring to Table 1.

    Table 1 Parameters of a field attribute

    Field Attribute

    Parameter

    Description

    Example Value

    Custom dictionary

    Value Range

    When recognizing text of the current field type, select the most similar value in the value range of the dictionary as the final recognition result.

    For example,

    Field Type Name: City

    Field Attribute: Custom dictionary

    Value Range: Shenzhen, Beijing, and Xi'an

    When the field type of the text to be recognized is City, a value most similar to the text to be recognized is selected as the recognition result from values Shenzhen, Beijing, and Xi'an.

    Custom regular expression extraction

    Pre-filter

    Preprocess the to-be-recognized text.

    Enter a regular expression of text to be replaced in the text box on the left.

    Enter new text in the text box on the right.

    If this field is left blank, no preprocessing is performed by default.

    If you need to preprocess the text for multiple times, click and enter new preprocessing rule.

    For example,

    Field Type Name: Birthday

    Field Attribute: Custom regular expression extraction

    Pre-filter: /

    Extract: \year\month\day

    Post-process: year /.day/. or

    day/year month

    When the text Born on 2020 January 01 whose field type is Birthday is recognized, do not perform pre-filtering, extract key characters 2020 January 01, and finally post-process the key characters, and finally the extracted content is 2020.1.1.

    Extract

    Extract key characters from the preprocessed text.

    Enter a regular expression for searching for key characters in the text box.

    If this field is left blank, all fields will be extracted by default.

    If multiple extraction rules are required, click to add extraction rules. During extraction, the first non-empty content is selected as the extracted content based on the priority rule from top to bottom.

    Post-process

    Post-process the extracted text based on your needs.