tencent cloud

Cloud Object Storage

Release Notes and Announcements
Release Notes
Announcements
Product Introduction
Overview
Features
Use Cases
Strengths
Concepts
Regions and Access Endpoints
Specifications and Limits
Service Regions and Service Providers
Billing
Billing Overview
Billing Method
Billable Items
Free Tier
Billing Examples
Viewing and Downloading Bill
Payment Overdue
FAQs
Getting Started
Console
Getting Started with COSBrowser
User Guide
Creating Request
Bucket
Object
Data Management
Batch Operation
Global Acceleration
Monitoring and Alarms
Operations Center
Data Processing
Content Moderation
Smart Toolbox
Data Processing Workflow
Application Integration
User Tools
Tool Overview
Installation and Configuration of Environment
COSBrowser
COSCLI (Beta)
COSCMD
COS Migration
FTP Server
Hadoop
COSDistCp
HDFS TO COS
GooseFS-Lite
Online Tools
Diagnostic Tool
Use Cases
Overview
Access Control and Permission Management
Performance Optimization
Accessing COS with AWS S3 SDK
Data Disaster Recovery and Backup
Domain Name Management Practice
Image Processing
Audio/Video Practices
Workflow
Direct Data Upload
Content Moderation
Data Security
Data Verification
Big Data Practice
COS Cost Optimization Solutions
Using COS in the Third-party Applications
Migration Guide
Migrating Local Data to COS
Migrating Data from Third-Party Cloud Storage Service to COS
Migrating Data from URL to COS
Migrating Data Within COS
Migrating Data Between HDFS and COS
Data Lake Storage
Cloud Native Datalake Storage
Metadata Accelerator
GooseFS
Data Processing
Data Processing Overview
Image Processing
Media Processing
Content Moderation
File Processing Service
File Preview
Troubleshooting
Obtaining RequestId
Slow Upload over Public Network
403 Error for COS Access
Resource Access Error
POST Object Common Exceptions
API Documentation
Introduction
Common Request Headers
Common Response Headers
Error Codes
Request Signature
Action List
Service APIs
Bucket APIs
Object APIs
Batch Operation APIs
Data Processing APIs
Job and Workflow
Content Moderation APIs
Cloud Antivirus API
SDK Documentation
SDK Overview
Preparations
Android SDK
C SDK
C++ SDK
.NET(C#) SDK
Flutter SDK
Go SDK
iOS SDK
Java SDK
JavaScript SDK
Node.js SDK
PHP SDK
Python SDK
React Native SDK
Mini Program SDK
Error Codes
Harmony SDK
Endpoint SDK Quality Optimization
Security and Compliance
Data Disaster Recovery
Data Security
Cloud Access Management
FAQs
Popular Questions
General
Billing
Domain Name Compliance Issues
Bucket Configuration
Domain Names and CDN
Object Operations
Logging and Monitoring
Permission Management
Data Processing
Data Security
Pre-signed URL Issues
SDKs
Tools
APIs
Agreements
Service Level Agreement
Privacy Policy
Data Processing And Security Agreement
Contact Us
Glossary

Face Detection

PDF
Modo Foco
Tamanho da Fonte
Última atualização: 2026-01-09 22:08:42

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>


Ajuda e Suporte

Esta página foi útil?

comentários