Celebrity Recognition
Function
This API can analyze and identify well-known people, such as celebrities and Internet celebrities in images, and return the information about the figures and their face coordinates.
Prerequisites
- Before using Celebrity Recognition, you need to apply for the service and complete authentication. For details, see Applying for a Service and Authentication.
- By default, the maximum number of concurrent API calls is 5. To increase concurrency, contact Huawei technical support.
URI
URI format
POST /v1.0/image/celebrity-recognition
Request Message
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| image | false | String | Configure either this parameter or url. Indicates the Base64 character string converted from the image. The size cannot exceed 10 MB. The face of a political figure must contain at least 40 x 40 pixels. The supported image formats include JPG, PNG, and BMP. |
| url | false | String | Configure either this parameter or image. Indicates the URL of an image. The options are as follows:
NOTE:
|
| threshold | false | float | Indicates the threshold of the confidence score. The value ranges from 0 to 1. If you input a value beyond the value range, the default value is used. The default value is 0.9. |
Response Message
| Parameter | Type | Description |
|---|---|---|
| result | Array | Indicates the calling result when the API is successfully called. This parameter is not included when the API fails to be called. |
| confidence | Number | Indicates the confidence score. The value ranges from 0 to 1. |
| face_detail | Object | Indicates the face coordinates in the politics scenario, including the following four attributes: h: indicates the height of the face area. w: indicates the width of the face area. x: indicates the distance from the upper left corner of the face area to the y axis. y: indicates the distance from the upper left corner of the face area to the x axis. |
| label | String | Indicates the information about a celebrity. |
| 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://image.cn-north-1.myhuaweicloud.com/v1.0/image/celebrity-recognition Request Header: Content-Type:application/json X-Auth-Token: MIINRwYJKoZIhvcNAQcCoIINODCCDTQCAQExDTALBglghkgBZQMEAgEwgguVBgkqhkiG... Request Body: { "image":"/9j/4AAQSkZJRgABAgEASABIAAD/4RFZRXhpZgAATU0AKgAAAAgABwESAAMAAAABAAEAAAEaAAUAAAABAAAAYgEbAAUAAAABAAAAagEoAAMAAAABAAIAAAExAAIAAAAcAAAAcgEyAAIAAAAUAAAAjodpAAQAAAABAAAApAAAANAACvyAAAAnEAAK/IAAACcQQWRvYmUgUGhvdG9zaG9wIENTMyBXaW5kb3dzADIwMTc6MTA6MjAgMTA6NDU6MzYAAAAAA6ABAAMAAAAB//8AAKACAAQAAAABAAALIKADAAQAAAABAAAGQAAAAAAAAAAGAQMAAwAAAAEABgAAARoABQAAAAEAAAEeARsABQAAAAEAAAEmASgAAwAAAAEAAgAAAgEABAAAAAEAAAEuAgIABAAAAAEAABAj...", "url": "", "threshold": "" } - Example request (Method 2: Use the URL redirecting to an image file.)
POST https://image.cn-north-1.myhuaweicloud.com/v1.0/image/celebrity-recognition Request Header: Content-Type:application/json X-Auth-Token: MIINRwYJKoZIhvcNAQcCoIINODCCDTQCAQExDTALBglghkgBZQMEAgEwgguVBgkqhkiG... Request Body: { "image":"", "url":"https://<bucketName>.obs.<region>.myhuaweicloud.com/<objectName>", "threshold": "" } - Example successful response
{ "result": [{ "confidence": 0.44977834820747375, "face_detail": { "h": 280, "w": 186, "x": 163, "y": 117 }, "label": "xxx" } ] } - Example failed response
{ "error_code": "AIS.0014", "error_msg": "The JSON format of the input data is incorrect." }
Return Value
- Normal
- 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.
Error Codes
For details about error codes, see Error Codes.
Last Article: Image Tagging (v2.0)
Next Article: Recapture Detection
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.