Image OCR
The Image OCR operator uses a multilingual optical character recognition (OCR) algorithm to detect and extract text from images in mixed-language environments. This topic describes how to configure the Image OCR operator.
Prerequisites
-
You must purchase the unstructured data feature for your instance before you can use the workflow feature.
-
You have created a workflow. For detailed steps, see Create and manage a workflow.
Permissions
In a Basic project, project administrators, developers, analysts, and custom project roles with the Dataset-Use permission can use any dataset in the project as an input or output for the operator.
Supported file formats
The Image OCR operator supports the following file formats: jpg and png.
Procedure
-
In the top navigation bar of the Dataphin homepage, choose Develop > Data Development.
-
In the top navigation bar of the Develop page, select Project.
-
In the left navigation pane, choose Data Processing > Workflow. In the Workflow list, click the target workflow to open its canvas. From the Operator Library on the left, drag the Image OCR operator onto the canvas. In the Image OCR panel on the right, configure the following parameters.
Parameter
Description
Step Name
Enter a name for the operator. The name can be up to 256 characters long.
Input Configuration
Dataset
Select the dataset to process. Only Hybrid Datasets are supported. After selecting a dataset, you must select a Version. The earliest version is selected by default.
If this operator follows another in a workflow, its input dataset is typically the output from the upstream operator.
Input Field
Select the field from the input dataset that contains the storage URLs of the images to process. Only fields with the Is URL parameter set to Yes are available for selection.
Filter (optional)
Enter a filter condition using SQL syntax, omitting the
WHEREkeyword. System global variables, such as the business date ${bizdate}, are supported.Operator Configuration
Processing Model
You can select a Built-in System Model (paddleOCR) or a multimodal large model. If you choose the latter, you must also specify a Model. Only models that are of the Vision (Images and Videos) type and are Enabled under Intelligent Application Management > Model Configuration can be selected.
NoteFor information about the pricing factor for system models, see Supported built-in models for intelligent applications.
If you have purchased an advanced license package for custom models, no Credits are deducted. Otherwise, usage is billed with a 0.2x factor.
Output Configuration
Dataset
You can select either the Source Dataset or an Other Dataset. If the source dataset's metadata table lacks a primary key, the output must be set to Other Dataset.
When you select Other Dataset, you must specify a Hybrid Dataset or a Table Dataset and its Version as the output dataset. The system defaults to the first available version.
When you select a source dataset, the metadata generated by the operator is written to the metadata table for the same version of the source dataset.
Load policy
If the metadata table of the selected output dataset contains a primary key, update on primary key conflict is selected by default. If a primary key does not exist, append data is selected by default.
-
append data: Adds new data to the target table. This operation fails if a primary key or constraint conflict occurs.
-
update on primary key conflict: If a primary key or constraint conflict occurs, the existing row with the duplicate key is deleted before the new data is inserted.
-
overwrite: Deletes all existing data from the target table before writing the new data.
NoteWhen the output dataset is set to Source Dataset, only the update on primary key conflict load policy is supported.
Field mapping
The Image OCR operator always outputs the following field:
ocr_content: The recognized text content (multiple segments are separated by``).By default, output fields are mapped to same-named fields in the output dataset. You can customize these mappings and also map pass-through fields from the source to the target dataset. Use the following options to manage field mappings:
-
Add Output Field: Adds a new, empty row for field mapping. This option is available only when the output dataset is set to Other Dataset.
-
Batch Mapping: Lets you perform batch mapping by manual selection, same name, or same row. This option is available only when the output dataset is set to Other Dataset.
-
Deleting a mapping: Click the Delete icon to remove the corresponding field mapping row. Mappings for the operator's fixed output fields cannot be deleted.
-
When you finish configuring the operator, click Save in the top menu bar of the canvas.
After configuring the operator, you can continue building the workflow by connecting it to upstream or downstream operators.