Moderation Feedback
Function
If you find that the result of Image Moderation is not as expected, you can call this API to report the image and expected moderation result to Image Moderation. The feedback will be used for optimizing Image Moderation.
The HUAWEI CLOUD account information and region information for calling this API must be the same as those for calling the Image Moderation APIs.
URI
URI format
POST /v1.1/moderation/image/feedback
Request Message
Table 1 describes the request parameters.
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| suggestion | Yes | String | Indicates whether the check is passed. block: indicates that sensitive information is detected and the information fails to pass the check. pass: indicates that no sensitive information is detected and the information passes the check. NOTE: The feedback other than block|pass is meaningless for algorithm optimization. |
| image | Configure either this parameter or url. | String | Indicates the Base64 character string converted from the image for feedback. The size cannot exceed 10 MB. In the politics scenario, the face of a political figure must be greater than or equal to 50 x 50 pixels. The supported image formats include JPG, PNG, and BMP. |
| url | Configure either this parameter or image. | String | Indicates the URL of the image for feedback. The options are as follows:
|
| categories | No | Array | Indicates the moderation scenario of the feedback.
If the parameter is left blank, the default values, politics and terrorism, are used. |
Response Message
Table 2 describes the response parameters.
| Parameter | Type | Description |
|---|---|---|
| result | String | If the API is successfully called, the value of this field is Thank you for your feedback. This parameter is not included when the API fails to be called. |
| error_code | String | Indicates the error code of a failed API call. For details, see Error Codes. This parameter is not included when the API is successfully called. |
| error_msg | String | Indicates the error message of a failed API call. This parameter is not included when the API is successfully called. |
Examples
- Example request (Method 1: Use a Base64-encoded image.)
POST https://moderation.cn-north-1.myhuaweicloud.com/v1.1/moderation/image/feedback Request Header: Content-Type:application/json X-Auth-Token: MIINRwYJKoZIhvcNAQcCoIINODCCDTQCAQExDTALBglghkgBZQMEAgEwgguVBgkqhkiG... Request Body: { "url" : "", "image" : "/9j/4AAQSkZJRgABAgEASABIAAD/4RFZRXhpZgAATU0AKgAAAAgABwESAAMAAAABAAEAAAEaAAUAAAABAAAAYgEbAAUAAAABAAAA...", "categories":[ "politics" "terrorism" "porn", ], "suggestion" : "block" }
- Example request (Method 2: Use the URL redirecting to the image file.)
POST https://moderation.cn-north-1.myhuaweicloud.com/v1.1/moderation/image/feedback Request Header: Content-Type:application/json X-Auth-Token: MIINRwYJKoZIhvcNAQcCoIINODCCDTQCAQExDTALBglghkgBZQMEAgEwgguVBgkqhkiG... Request Body: { "url" : "https://BucketName.obs.myhuaweicloud.com/ObjectName", "image" : "", "categories":[ "politics" "terrorism" "porn", ], "suggestion" : "block" }
- Example successful response
{ "result": "Thank you for your feedback." } - Example failed response
{ "error_code": "AIS.0005", "error_msg": "The service does not exist." }
- Abnormal
Return Value
Description
400
- The request cannot be understood by the server due to malformed syntax. The client should not repeat the request without modifications.
- The request parameter is incorrect.
401
The request requires user authentication.
403
No operation permission.
404
The server has not found anything matching the Request-URI.
500
The server encountered an unexpected condition which prevented it from fulfilling the request.
Last Article: Job List Query
Next Article: Deprecated APIs
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.