tencent cloud

Cloud Infinite

Release Notes and Announcements
Release Notes
Announcements
Product Introduction
Product Overview
Product Strengths
Use Cases
Feature Overview
Regions and Domains
Specifications and Limits
Billing
Billing Overview
Billing Mode
Billable Items
Free Tier
Payment Overdue
Viewing Bill Details
FAQs
Getting Started
Registering and Logging In
Bind Bucket
Uploading and Processing File
Downloading and Deleting Images
Unbinding Buckets
Using CI via COS
Features
Image Processing
Media Processing
Content Moderation
AI Content Recognition
File Processing
Smart Voice
File processing
User Guide
Overview
Bucket Management
Smart Toolbox
Job and Workflow
Data Monitoring
Usage statistics
Use Cases
Copyright Protection Solutions
Image Processing Practices
Working with API Authorization Policies
Workflow Practices
API Documentation
API Overview
Structure
Common Request Headers
Common Response Headers
Activate Vast Service
Image Processing
AI-Based Content Recognition
Smart Audio
Media Processing
Content Moderation
Document Processing
File Processing
Job and Workflow
Cloud Virus Detection
Error Codes
Request Signature
SDK Documentation
SDK Overview
Android SDK
iOS SDK
COS Android SDK
C SDK
C++ SDK
.NET(C#) SDK
Go SDK
COS iOS SDK
Java SDK
JavaScript SDK
Node.js SDK
PHP SDK
Python SDK
Mini Program SDK
Personal Information Protection Policy for SDK
Security and Compliance
Permission ‍Management
FAQs
Basic Settings
Document Processing
Media Processing
Content Recognition
Smart Audio
Agreements
Service Level Agreement
Contact Us
Glossary

Face Detection

PDF
Mode fokus
Ukuran font
Terakhir diperbarui: 2025-09-09 20:02:18

Feature Description

The face detection function uses a synchronous request method. You can detect the position of faces in the image through this interface.
Note:
This interface belongs to a GET request, uses a synchronous request method, and requires carrying a signature. For specific signature settings, please refer to Request Signature.
Unsupported for processing images of archive storage type and deep archive storage type on COS. If necessary to process such images, please first restore archived file.

Authorization Description

When used by a sub-account, the ci:CreateFaceEffectJob permission is required. For details, see Cloud Infinite action.

Activating a Service

Using this feature requires enabling Cloud Infinite in advance and binding a bucket. For details, see Bind Bucket.
Use this feature requires enabling AI Content Recognition service in advance through console or API. For details, see Enable AI Content Recognition Service.

Use Limits

When using this API, please first confirm the relevant restrictions. For details, see Usage Limits.
Supported formats: PNG, JPG, JPEG, BMP.
Image size: The downloaded image, after Base64 encoding, does not exceed 5MB.
Image pixels: For JPG format, the long side pixel must not exceed 4000. For other formats, the long side pixel must not exceed 2000.

Fee Description

Successful API call incurs face detection fee and COS read request fee.
If the image belongs to the infrequent accessed storage type on COS, a successful API call will incur COS infrequent data retrieval fee.


Request

Request sample

GET /<ObjectKey>?ci-process=DetectFace&max-face-num=<FaceNum> HTTP/1.1
Host: <BucketName-APPID>.cos.<Region>.myqcloud.com
Date: <GMT Date>
Authorization: <Auth String>
Note:
Authorization: Auth String. For details, see Request Signature document.

Request parameters

Parameter Name
Description
Type
Required or Not
ObjectKey
object filename, for example: folder/document.jpg.
String
Yes
ci-process
Cloud Infinite processing capability, face detection is fixed as DetectFace.
String
Yes
max-face-num
Maximum number of faces processed. The default value is 1 (only the face with the largest area in the image is detected), and the maximum value is 120. This parameter is used to control the number of faces processed in the image to be detected. A smaller value results in faster processing speed.
Integer
No

Request header

This API only uses common request headers. For details, see Common Request Headers documentation.

Request body

The request does not have a request body.

Response

Response Headers

This API only returns the public response header. For details, see Common Response Headers documentation.

Response Body

The response body is returned as application/xml. An example including the complete node data is shown below:
<Response>
<ImageWidth>616</ImageWidth>
<ImageHeight>442</ImageHeight>
<FaceModelVersion>4.0</FaceModelVersion>
<RequestId>NjEzZjBlZGRfOTBmYTUwNjRfZWUx****</RequestId>
<FaceInfos>
<X>312</X>
<Y>-5</Y>
<Width>117</Width>
<Height>173</Height>
</FaceInfos>
</Response>
The data are as follows:
Node Name (Keyword)
Parent Node
Description
Type
Response
None.
Container for saving results.
Container
The content of Response
Node Name (Keyword)
Parent Node
Description
Type
ImageWidth
Response
Image width of the request
Integer
ImageHeight
Response
Image height of the request
Integer
FaceModelVersion
Response
The algorithm model version used for face recognition.
String
RequestId
Response
unique request ID, returned for each request. RequestId is required for locating a problem.
String
Status
Response
Recognition status: 1 indicates a human face is detected in the image; 0 indicates no human face is detected in the image.
String
FaceInfos
Response
face information list. It contains face coordinate information.
Container
the content of FaceInfos node
Node Name (Keyword)
Parent Node
Description
Type
Score
FaceInfos
confidence degree. It represents the confidence level of detected faces, ranging from 0 to 100.
Integer
X
FaceInfos
horizontal coordinate of top-left corner of face frame. The face frame contains the positions of facial features and is expanded on this basis. If the face frame exceeds the image range, it can cause negative coordinate values.
Integer
Y
FaceInfos
vertical coordinate of top-left corner of face frame. The face frame contains the positions of facial features and is expanded on this basis. If the face frame exceeds the image range, it can cause negative coordinate values.
Integer
Width
FaceInfos
width of face frame
Integer
Height
FaceInfos
height of face frame
Integer

Error Codes

Following are the error codes related to API business logic. For other error information, please refer to the Error Code document.
Error Code
Description
FailedOperation.ConflictOperation
Operation conflict. Do not operate the same Person simultaneously.
FailedOperation.GroupInDeletedState
The current group is in deletion status. Please wait.
FailedOperation.GroupPersonMapExist
The group already contains the corresponding personnel ID.
FailedOperation.GroupPersonMapNotExist
The group does not include the corresponding personnel ID.
FailedOperation.ImageDecodeFailed
Image decoding failed.
FailedOperation.ImageDownloadError
Image download error.
FailedOperation.ImageFacedetectFailed
Face detection failed.
FailedOperation.ImageResolutionExceed
Image resolution is too high.
FailedOperation.ImageResolutionTooSmall
The short side resolution of the image is less than 64.
FailedOperation.ImageSizeExceed
Image data size after base64 encoding shall not exceed 5MB.
FailedOperation.RequestLimitExceeded
Request frequency exceeds the limit.
FailedOperation.RequestTimeout
Backend service timeout.
FailedOperation.ServerError
Algorithm service exception, please retry.
InternalError
internal error.
InvalidParameter.InvalidParameter
Invalid parameters.
InvalidParameterValue.AccountFaceNumExceed
The number of faces for the account exceeds the limit.
InvalidParameterValue.FaceModelVersionIllegal
Invalid algorithm model version.
InvalidParameterValue.ImageEmpty
Image is empty.
InvalidParameterValue.LimitExceed
The number of returned results exceeds the limit.
InvalidParameterValue.NoFaceInPhoto
No human face in the image.
InvalidParameterValue.UrlIllegal
The URL format is invalid.
LimitExceeded.ErrorFaceNumExceed
The number of human faces exceeds the limit.
MissingParameter.ErrorParameterEmpty
Required parameter is empty.
ResourceUnavailable.Freeze
The account has been frozen.
ResourceUnavailable.InArrears
Account in arrears.
ResourceUnavailable.LowBalance
Insufficient balance.
ResourceUnavailable.StopUsing
Account suspended.
ResourceUnavailable.UnknownStatus
Billing status unknown.
ResourcesSoldOut.ChargeStatusException
Billing status abnormal.
UnsupportedOperation.UnknowMethod
Unknown method name.

Examples

Request

GET /test.jpg?max-face-num=1&ci-process=detect-face HTTP/1.1
Authorization: q-sign-algorithm=sha1&q-ak=************************************&q-sign-time=1497530202;1497610202&q-key-time=1497530202;1497610202&q-header-list=&q-url-param-list=&q-signature=****************************************
Host: examplebucket-1250000000.cos.ap-beijing.myqcloud.com

Response

HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: 414641
Date: Thu, 15 Jun 2017 12:37:29 GMT
Server: tencent-ci
x-ci-request-id: NTk0MjdmODlfMjQ4OGY3XzYzYzhf****

<Response>
<ImageWidth>616</ImageWidth>
<ImageHeight>442</ImageHeight>
<FaceModelVersion>3.0</FaceModelVersion>
<RequestId>NjEzZjBlZGRfOTBmYTUwNjRfZWUxXzE=</RequestId>
<FaceInfos>
<X>312</X>
<Y>-5</Y>
<Width>117</Width>
<Height>173</Height>
</FaceInfos>
<FaceInfos>
<X>600</X>
<Y>-5</Y>
<Width>117</Width>
<Height>173</Height>
</FaceInfos>
</Response>


Bantuan dan Dukungan

Apakah halaman ini membantu?

masukan