Recognize text in E-commerce images with OCR

更新时间:
复制 MD 格式

1. Component introduction

Note

Required preceding components: None

Recommended subsequent components: Conditional Branch. Use a conditional branch to check if the OCR call was successful, and then design the subsequent flow.

This component uses Optical Character Recognition (OCR) technology to recognize text in images from online scenarios, such as E-commerce product promotions, online forums, and user-generated content (UGC). For more information, see Recognize text in E-commerce images.

2. Inputs

Note

For information about each input, see the help text in the component panel of the application flow editor.

3. Outputs

Note

For information about each output, see the help text in the component panel of the application flow editor.

3.1. Key API return results

This output returns a dictionary that contains key recognition results from the API. The following table describes the key-value pairs in the dictionary.

Key

Key description

Value data type

content

A summary of the recognized text blocks from the image.

String

3.2. Error message

This output returns the error code and error message as a string. For more information, see the OCR Error Center.

https://next.api.aliyun.com/document/ocr-api/2021-07-07/errorCode

4. Component usage example

4.1. Component configuration example

  1. Set the AI engine to Alibaba Cloud OCR.

  2. For Path of the image file to recognize, enter the file path of the image. This example uses the following image.

    image

  3. Keep the default values for the advanced options.

4.2. Example execution result

image

5. Flow example

5.1. Build the flow

  1. Use the Recognize text in E-commerce images with OCR component and specify the path of the image file to recognize.

  2. Use the Conditional Branch component to determine whether the OCR call was successful. Set the branch condition to v_basic_success_1 is equal to the Boolean value True.

  3. In the success branch, use the Get value of a specified key component to retrieve the value of the content key from the v_basic_data_1 dictionary.

  4. Use the Record Log component to record the key recognition result.

  5. In the failure branch, use the Record Log component to record the error message.

5.2. Execution result

As shown in the following figure, after the OCR call is successful, the recognition result is printed in the log panel.

image