Intelligent element recognition (asynchronous)
Overview
The intelligent element recognition API detects specific elements in e-commerce images by analyzing their details. It helps you identify elements such as text, logos, watermarks, and color blocks with text on the main object and in the image background, improving image filtering efficiency and accuracy.
Use cases
Intelligent image filtering and optimization
Merchants and platforms can use this API to automatically detect and filter images containing specific elements like watermarks or logos. After filtering, use the Intelligent Erasing API to optimize these images, enhancing their quality and accelerating the product release cycle.
Automated image processing and efficiency improvement
This API lets merchants and platforms automate their image processing workflows. By automatically detecting and tagging elements that require optimization, the API reduces manual intervention and increases processing efficiency.
Features
For detailed examples of the main object, image background, text, logo, watermark, and color block with text, see the documentation for the Intelligent Erasing API. (Link placeholder)
Main object: The core product area in an image.
Image background: The parts of the image outside the main object.
Text: Horizontal, vertical, or diagonal text in English or Chinese.
Logo: A brand emblem or trademark.
Watermark: A monochromatic and transparent element, such as text, a logo, an image, a URL, or a store name.
Color block with text: A colored block containing text that is located outside the main object.
Element recognition: Detects whether elements such as text, logos, watermarks, and color blocks with text exist on the main object and in the image background.
Workflow integration: Combine this API with the Intelligent Erasing API. First, use intelligent element recognition to identify elements for removal, and then use the Intelligent Erasing API to remove them. This two-step process ensures an accurate and efficient workflow.
Technical advantages:
Asynchronous batch processing: The asynchronous invocation mode lets you process a large number of images without waiting for immediate responses, which is ideal for large-scale jobs.
Flexibility: You can select the specific element types to identify, such as watermarks, logos, or text. This applies to elements on both the main object and in the image background, allowing you to meet custom recognition requirements.
Results comparison
Original image | Recognition result |
| Object:
Non-Object:
|
| Object:
Non-Object:
|
API reference
Request parameters
Parameter | Type | Required | Description and example |
ImageUrl | String | required | The image URL. The image must be in JPG, JPEG, PNG, BMP, or WEBP format. Resolution must be between 256×256 and 3000x3000 pixels. The file size cannot exceed 10 MB. Example: |
ObjectDetectElements | number[] | optional | The elements to detect on the main object. You can select multiple types. Valid values are 1 (watermark), 2 (logo), 3 (text), and 4 (color block with text). Example: |
NonObjectDetectElements | number[] | optional | Detects elements that are not the main object (1 = watermark, 2 = logo, 3 = text, 4 = color block with text). You can select multiple element types. This parameter and objectDetectElements cannot both be empty. Example: |
ReturnCharacter | number | optional | Specifies whether to return the optical character recognition (OCR) results for detected text. Valid values are 1 (yes) and 0 (no). The default value is 0. Example: |
ReturnBorderPixel | number | optional | Specifies whether to return the distance from the main object to the image borders. Valid values are 1 (yes) and 0 (no). The default value is 0. Example: |
ReturnProductProp | number | optional | Specifies whether to return the area ratio of the main object. Valid values are 1 (yes) and 0 (no). The default value is 0. Example: |
ReturnProductNum | number | optional | Specifies whether to return the number of main objects. Valid values are 1 (yes) and 0 (no). The default value is 0. Example: |
ReturnCharacterProp | number | optional | Specifies whether to return the area ratio of the text. Valid values are 1 (yes) and 0 (no). The default value is 0. This parameter takes effect only when both of the following conditions are met: 1) The returnCharacter parameter must also be set to 1. 2) One of the Example: |
Request example
{
"ImageUrl": "https://aib-innovation-oss.oss-accelerate.aliyuncs.com/AI_Business/ccETg/detectiontest.png?Expires=3356500864&OSSAccessKeyId=LTAI5tE8X3gEy66SRU1V8dig&Signature=wDKmatQO3THYqYg6yojCyHAVRq0%3D",
"ObjectDetectElements": [
1,
2,
3,
4
],
"NonObjectDetectElements": [
1,
2,
3,
4
],
"ReturnCharacter": 1,
"ReturnBorderPixel": 1,
"ReturnProductProp": 1,
"ReturnProductNum": 1,
"ReturnCharacterProp": 1
}Response parameters
Parameter | Type | Description |
Code | String | The status code of the response. A value of |
RequestId | String | A unique identifier for the request. |
Success | Boolean | Indicates if the request was successful. |
Message | String | The error message returned if the request fails. |
Data | Object | A container for the recognition results. |
Data.ObjLogo | Boolean | Indicates if a logo exists on the main object. |
Data.PdNum | Number | The number of main objects. |
Data.NoobjLogo | Boolean | Indicates if a logo exists outside the main object. |
Data.ObjCharacter | Boolean | Indicates if text exists on the main object. |
Data.BorderPixel | String | The distance from the main object to the image borders, returned as a string in the format |
Data.UsageMap | Object | The usage data for the call. |
Data.ObjWatermark | Boolean | Indicates if a watermark exists on the main object. |
Data.RecText | Array<String> | The recognized text from the OCR process. |
Data.NoobjNpx | Boolean | Indicates if a color block with text exists outside the main object. |
Data.NoobjWatermark | Boolean | Indicates if a watermark exists outside the main object. |
Data.TextProp | String | The area ratio of the text. For example, "7.56%". |
Data.ObjNpx | Boolean | Indicates if a color block with text exists on the main object. |
Data.PdProp | String | The area ratio of the main object, returned as a percentage string. Example: '23.45%'. |
Data.NoobjCharacter | Boolean | Indicates if text exists outside the main object. |
Response example
{
"Data": {
"ObjLogo": false,
"PdNum": 2,
"NoobjLogo": false,
"ObjCharacter": false,
"BorderPixel": "0,1,0,1,1024,1024",
"UsageMap": {
"ProcessedImageCount": 1
},
"ObjWatermark": false,
"RecText": [
"Skin-friendly feel",
"Fine and silky",
"Upgraded model",
"Better camera protection",
"aaa store",
"10px 50%"
],
"NoobjNpx": true,
"NoobjWatermark": true,
"TextProp": "8.10%",
"ObjNpx": false,
"PdProp": "58.36%",
"NoobjCharacter": true
},
"RequestId": "6002ADA3-5CD2-103C-83D8-BF9356FBD555",
"Message": "Success",
"Code": "success",
"Success": true
}Error codes
For more information, see Error codes.
Integration and invocation
Before you begin
The intelligent element recognition feature supports both synchronous and asynchronous invocation modes. This document describes the asynchronous API. For synchronous invocation, see Intelligent element recognition.
The asynchronous APIs for intelligent element recognition and other features share the same result retrieval process, RocketMQ subscription rules, message encryption protocol, dependency configurations, and Java code for consumption and decryption.
For details on the integration process, subscription rules, message format, encryption protocol, and implementation guides for asynchronous calls, see Asynchronous API call instructions.
Billing
¥0.02 per image
Limitations
Invocation mode: Job submission calls are synchronous, while image processing is asynchronous. The default job submission limit is 5 QPS, with a 30-second request timeout.
Input image: The image must be in JPG, JPEG, PNG, BMP, or WEBP format. The resolution must be between 256×256 and 3000×3000 pixels. The file size must be 10 MB or less.
Billing: Billed based on
ProcessedImageCount.
FAQ
1. How do I use the intelligent element recognition API?
A: This API is typically used with the Intelligent Erasing API. First, use intelligent element recognition to filter images based on your criteria, then use the Intelligent Erasing API to remove unwanted elements. The API's built-in OCR feature also lets you filter images by their text content and recognize the text itself.
2. What is a "color block with text"?
A: This term generally refers to sticker-like ads or colored labels that contain text.

