Creates an image moderation task to ensure image content compliance. You can call this operation to identify inappropriate content, such as pornography, violence, terrorism, politically sensitive content, undesirable scenes, unauthorized logos, and non-compliant ads.
Operation description
-
Before you call this operation, make sure that you are familiar with the billing of Intelligent Media Management (IMM).****
**
Note Asynchronous processing does not guarantee timely task completion.
-
The image for which you want to create a content moderation task must meet the following requirements:
- The image URL supports the HTTP and HTTPS protocols.
- The image is in one of the following formats: PNG, JPG, JPEG, BMP, GIF, and WebP
- The image size is limited to 20 MB for synchronous and asynchronous calls, with a maximum height or width of 30,000 pixels. The total number of pixels cannot exceed 250 million. GIF images are limited to 4,194,304 pixels, with a maximum height or width of 30,000 pixels.
- The image download time is limited to 3 seconds. If the download takes longer, a timeout error occurs.
- To ensure effective moderation, we recommend that you submit an image with dimensions of at least 256 × 256 pixels.
- The response time of the CreateImageModerationTask operation varies based on the duration of the image download. Make sure that the image is stored in a stable and reliable service. We recommend that you store images on Alibaba Cloud Object Storage Service (OSS) or cache them on Alibaba Cloud CDN.
-
This operation is an asynchronous operation. After a task is executed, the task information is retained only for seven days and cannot be retrieved when the retention period elapses. You can call the GetTask or ListTasks operation to query information about the task.`` If you specify Notification , you can also obtain information about the task based on notifications.
-
pass: No non-compliant content is found.
-
block: Non-compliant content is detected. The Categories field value indicates the non-compliance categories. For more information, see Content moderation results.
-
review: A manual review is needed. After the manual review is finished, another asynchronous notification is sent to inform you about the review result. >
Debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action
policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- The required resource types are displayed in bold characters.
- If the permissions cannot be granted at the resource level,
All Resources
is used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
imm:CreateImageModerationTask | create | *Project acs:imm:{#regionId}:{#accountId}:project/{#ProjectName} |
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
ProjectName | string | Yes | The name of the project. You can obtain the name of the project from the response of the CreateProject operation. | immtest |
UserData | string | No | The user data, which is returned in an asynchronous notification and facilitates notification management. The maximum length of the user data is 2,048 bytes. | {"ID": "user1","Name": "test-user1","Avatar": "http://example.com?id=user1"} |
SourceURI | string | Yes | The URI of the Object Storage Service (OSS) bucket in which you store the image. Specify the value in the | oss://test-bucket/test-object |
Tags | object | No | The custom tags. You can search for or filter asynchronous tasks by custom tag. | {"test": "val1"} |
CredentialConfig | CredentialConfig | No | The authorization chain. For more information, see Use authorization chains to access resources of other entities. | |
Scenes | array | No | The scenarios in which you want to apply the image moderation task. | |
string | No | The scenario in which you want to apply the image moderation task.
Note
If you do not specify this parameter, porn , terrorism , and ad are automatically used.
| porn | |
Interval | long | No | The time interval between two consecutive frames in a GIF or long image. Default value: 1. | 2 |
MaxFrames | long | No | The maximum number of frames that can be captured in a GIF or long image. Default value: 1. | 10 |
Notification | Notification | No | The notification settings. For more information, click Notification. For information about the asynchronous notification format, see Asynchronous notification format. |
Response parameters
Examples
Sample success responses
JSON
format
{
"RequestId": "1B3D5E0A-D8B8-4DA0-8127-ED32C851****",
"TaskId": "ImageModeration-179ef4f8-d583-4f0c-a293-7c0889c*****",
"EventId": "2E6-1I0FGn0zFnl5AflRfhzClma*****"
}
Error codes
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|---|---|
2024-04-19 | The API operation is not deprecated.. The Error code has changed | View Change Details |
2023-08-21 | The Error code has changed. The request parameters of the API has changed | View Change Details |
2023-04-03 | The Error code has changed. The request parameters of the API has changed | View Change Details |
2023-03-09 | The Error code has changed. The request parameters of the API has changed | View Change Details |
2022-08-16 | The Error code has changed. The request parameters of the API has changed | View Change Details |
2022-08-16 | The Error code has changed. The request parameters of the API has changed | View Change Details |