VerifyPerson

Last updated: 2021-01-20 17:19:45

    1. API Description

    Domain name for API request: iai.tencentcloudapi.com.

    This API is used to judge whether a person in an image corresponds to a given PersonId. For more information on PersonId, please see Group Management APIs.
    This API fuses the features of all face images of a person; for example, if a person has 4 face images, it will fuse the features of the 4 face images and generate the summarized facial features of the person to make the person verification (i.e., judging whether the face image to be recognized is of a specified person) more accurate.

    The face verification APIs judge whether a person is someone specified whose information is stored in a group, and the "someone" may have multiple face images. By contrast, the face comparison APIs judge the similarity between two faces.

    • Please use the signature algorithm v3 to calculate the signature in the common parameters, that is, set the SignatureMethod parameter to TC3-HMAC-SHA256.
    • This feature is available only to groups whose algorithm model version (FaceModelVersion) is 3.0.
    We recommend you to use API Explorer
    Try it
    API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

    2. Input Parameters

    The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

    Parameter Name Required Type Description
    Action Yes String Common parameter. The value used for this API: VerifyPerson.
    Version Yes String Common parameter. The value used for this API: 2020-03-03.
    Region Yes String Common parameter. For more information, please see the list of regions supported by the product.
    PersonId Yes String ID of the person to be verified. For more information on PersonId, please see the group management APIs.
    Image No String Base64-encoded data of the image.
    The long side cannot exceed 4,000 px for images in JPG format or 2,000 px for images in other formats.
    If there are multiple faces in the image, only the face with the largest size will be selected.
    PNG, JPG, JPEG, and BMP images are supported, while GIF images are not.
    Url No String Image URL
    The long side cannot exceed 4,000 px for images in JPG format or 2,000 px for images in other formats.
    Either Url or Image must be provided; if both are provided, only Url will be used.
    We recommend storing the image in Tencent Cloud, as a Tencent Cloud URL can guarantee higher download speed and stability.
    The download speed and stability of non-Tencent Cloud URLs may be low.
    If there are multiple faces in the image, only the face with the largest size will be selected.
    PNG, JPG, JPEG, and BMP images are supported, while GIF images are not.
    QualityControl No Integer Image quality control.
    0: no control.
    1: low quality requirement. The image has one or more of the following problems: extreme blurriness, covered eyes, covered nose, and covered mouth.
    2: average quality requirement. The image has at least three of the following problems: excessive brightness, excessive dimness, blurriness or average blurriness, covered eyebrows, covered cheeks, and covered chin.
    3: high-quality requirement. The image has one to two of the following problems: excessive brightness, excessive dimness, average blurriness, covered eyebrows, covered cheeks, and covered chin.
    4: very high-quality requirement. The image is optimal in all dimensions or only has a slight problem in one dimension.
    Default value: 0.
    If the image quality does not meet the requirement, the returned result will prompt that the detected image quality is unsatisfactory.
    NeedRotateDetection No Integer Whether to enable the support for rotated image recognition. 0: no; 1: yes. Default value: 0. When the face in the image is rotated and the image has no EXIF information, if this parameter is not enabled, the face in the image cannot be correctly detected and recognized. If you are sure that the input image contains EXIF information or the face in the image will not be rotated, do not enable this parameter, as the overall time consumption may increase by hundreds of milliseconds after it is enabled.

    3. Output Parameters

    Parameter Name Type Description
    Score Float Similarity between given face image and PersonId. If there are multiple faces under the PersonId, their information will be fused for verification.
    IsMatch Boolean Whether the person in the image matches the PersonId.
    FaceModelVersion String Algorithm model version used for face recognition in the group where the Person is, which is set when the group is created.
    RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

    4. Example

    Example1 Verifying face

    Input Example

    https://iai.tencentcloudapi.com/?Action=VerifyPerson
    &Url=http://test.image.myqcloud.com/testA.jpg
    &PersonId=11111111
    &<Common request parameters>

    Output Example

    {
      "Response": {
        "Score": 100,
        "IsMatch": true,
        "FaceModelVersion": "3.0",
        "RequestId": "a8eb4545-a154-4f86-9510-57a8be9cae0c"
      }
    }

    5. Developer Resources

    SDK

    TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

    Command Line Interface

    6. Error Code

    The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

    Error Code Description
    FailedOperation.FaceQualityNotQualified The face image quality does not meet the requirement.
    FailedOperation.FaceSizeTooSmall The face frame size is smaller than the MinFaceSize value, and the face is filtered out.
    FailedOperation.ImageDecodeFailed Image decoding failed.
    FailedOperation.ImageDownloadError An error occurred while downloading the image.
    FailedOperation.ImageFacedetectFailed Face detection failed.
    FailedOperation.ImageResolutionExceed The image resolution is too high.
    FailedOperation.ImageResolutionTooSmall The image short edge resolution is smaller than 64.
    FailedOperation.ImageSizeExceed The size of the Base64-encoded image cannot exceed 5 MB.
    FailedOperation.RequestLimitExceeded The request frequency exceeds the limit.
    FailedOperation.RequestTimeout The backend service timed out.
    FailedOperation.ServerError The algorithm service is exceptional. Please retry.
    InternalError Internal error.
    InvalidParameter.InvalidParameter Invalid parameter.
    InvalidParameterValue.ImageEmpty Empty image.
    InvalidParameterValue.NoFaceInGroups There are no faces in the specified group.
    InvalidParameterValue.NoFaceInPhoto There are no faces in the image.
    InvalidParameterValue.PersonIdIllegal The person ID contains invalid characters. It can contain only letters, digits, and -%@#&_.
    InvalidParameterValue.PersonIdNotExist The person ID does not exist.
    InvalidParameterValue.QualityControlIllegal Invalid QualityControl parameter.
    InvalidParameterValue.UnsupportedGroupFaceModelVersion This operation is not supported by algorithm model v2.0 or below.
    InvalidParameterValue.UrlIllegal Invalid URL format.
    ResourceUnavailable.ChargeStatusException The account is in arrears.
    ResourceUnavailable.Freeze The account is frozen.
    ResourceUnavailable.GetAuthInfoError Failed to get the authentication information.
    ResourceUnavailable.InArrears The account is in arrears.
    ResourceUnavailable.LowBalance Insufficient balance.
    ResourceUnavailable.NotExist The billing status is unknown. Please check whether the service has been activated in the console.
    ResourceUnavailable.NotReady The service is not activated.
    ResourceUnavailable.UnknownStatus The billing status is unknown.
    ResourcesSoldOut.ChargeStatusException The billing status is exceptional.
    UnsupportedOperation.UnknowMethod Unknown method name.